-----------------------------------------------------------------------------------
      name:  <unnamed>
       log:  C:\Users\jgw12\Dropbox\Research\PersPartyBook\Data\FKTW-reproduction\C
> h2-Appendix.log
  log type:  text
 opened on:  26 Jul 2023, 15:49:57

. 
.         ******************************
.         **** Set directory, seed *****
.         ******************************
.                 set more off 

.                 set matsize 1000
set matsize ignored.
    Matrix sizes are no longer limited by c(matsize) in modern Statas.  Matrix
    sizes are now limited by edition of Stata.  See limits for more details.

.                 global seed ="984353"

.                 set scheme plotplain

.                 cd "$dir"
C:\Users\jgw12\Dropbox\Research\PersPartyBook\Data\FKTW-reproduction

. 
. ***************************************************************
. **** Load, clean, and merge external data sets for merging ****
. ***************************************************************
.                         import excel "$dir\wdi-original", clear firstrow  /* down
> loaded 12.20.21 */
(16 vars, 9,315 obs)

.                         gen n = _n

.                         drop if n>9310
(5 observations deleted)

.                         destring _all,replace ignore("..")
Time: all characters numeric; replaced as int
TimeCode: contains characters not specified in ignore(); no replace
CountryName: contains characters not specified in ignore(); no replace
CountryCode: contains characters not specified in ignore(); no replace
Accesstoelectricityofpopu already numeric; no replace
GDPpercapitaconstant2015US already numeric; no replace
GDPpercapitagrowthannual already numeric; no replace
PopulationgrowthannualSP already numeric; no replace
PopulationtotalSPPOPTOTL already numeric; no replace
Povertyheadcountratioat190 already numeric; no replace
Mobilecellularsubscriptionsp already numeric; no replace
Mortalityrateunder5per10 already numeric; no replace
Mortalityrateinfantper100 already numeric; no replace
OilrentsofGDPNYGDPPET already numeric; no replace
Fixedbroadbandsubscriptionsp already numeric; no replace
NaturalgasrentsofGDPNY already numeric; no replace
n already numeric; no replace

.                         rename Time year

.                         rename CountryName wdi_country

.                         rename CountryCode wdi_ccode

.                         gen country = wdi_country

.                         gen cowcode =.
(9,310 missing values generated)

.                         replace country ="Korea, Dem. Rep." if country=="Korea, D
> em. Peoples Rep."
(0 real changes made)

.                         qui do cowcodes

.                         tab wdi_country if cow==.

                           Country Name |      Freq.     Percent        Cum.
----------------------------------------+-----------------------------------
            Africa Eastern and Southern |         35        1.20        1.20
             Africa Western and Central |         35        1.20        2.41
                         American Samoa |         35        1.20        3.61
                             Arab World |         35        1.20        4.82
                                  Aruba |         35        1.20        6.02
                                Bermuda |         35        1.20        7.23
                 British Virgin Islands |         35        1.20        8.43
                             Cabo Verde |         35        1.20        9.64
                 Caribbean small states |         35        1.20       10.84
                         Cayman Islands |         35        1.20       12.05
         Central Europe and the Baltics |         35        1.20       13.25
                        Channel Islands |         35        1.20       14.46
                                Curacao |         35        1.20       15.66
             Early-demographic dividend |         35        1.20       16.87
                    East Asia & Pacific |         35        1.20       18.07
East Asia & Pacific (IDA & IBRD count.. |         35        1.20       19.28
East Asia & Pacific (excluding high i.. |         35        1.20       20.48
                               Eswatini |         35        1.20       21.69
                              Euro area |         35        1.20       22.89
                  Europe & Central Asia |         35        1.20       24.10
Europe & Central Asia (IDA & IBRD cou.. |         35        1.20       25.30
Europe & Central Asia (excluding high.. |         35        1.20       26.51
                         European Union |         35        1.20       27.71
                          Faroe Islands |         35        1.20       28.92
Fragile and conflict affected situati.. |         35        1.20       30.12
                       French Polynesia |         35        1.20       31.33
                              Gibraltar |         35        1.20       32.53
                              Greenland |         35        1.20       33.73
                                   Guam |         35        1.20       34.94
 Heavily indebted poor countries (HIPC) |         35        1.20       36.14
                            High income |         35        1.20       37.35
                   Hong Kong SAR, China |         35        1.20       38.55
                              IBRD only |         35        1.20       39.76
                       IDA & IBRD total |         35        1.20       40.96
                              IDA blend |         35        1.20       42.17
                               IDA only |         35        1.20       43.37
                              IDA total |         35        1.20       44.58
                            Isle of Man |         35        1.20       45.78
              Korea, Dem. People's Rep. |         35        1.20       46.99
                                 Kosovo |         35        1.20       48.19
              Late-demographic dividend |         35        1.20       49.40
              Latin America & Caribbean |         35        1.20       50.60
Latin America & Caribbean (excluding .. |         35        1.20       51.81
Latin America & the Caribbean (IDA & .. |         35        1.20       53.01
Least developed countries: UN classif.. |         35        1.20       54.22
                    Low & middle income |         35        1.20       55.42
                             Low income |         35        1.20       56.63
                    Lower middle income |         35        1.20       57.83
                       Macao SAR, China |         35        1.20       59.04
                  Micronesia, Fed. Sts. |         35        1.20       60.24
             Middle East & North Africa |         35        1.20       61.45
Middle East & North Africa (IDA & IBR.. |         35        1.20       62.65
Middle East & North Africa (excluding.. |         35        1.20       63.86
                          Middle income |         35        1.20       65.06
                             Montenegro |         35        1.20       66.27
                          New Caledonia |         35        1.20       67.47
                          North America |         35        1.20       68.67
                        North Macedonia |         35        1.20       69.88
               Northern Mariana Islands |         35        1.20       71.08
                         Not classified |         35        1.20       72.29
                           OECD members |         35        1.20       73.49
                     Other small states |         35        1.20       74.70
            Pacific island small states |         35        1.20       75.90
              Post-demographic dividend |         35        1.20       77.11
               Pre-demographic dividend |         35        1.20       78.31
                            Puerto Rico |         35        1.20       79.52
              Sint Maarten (Dutch part) |         35        1.20       80.72
                           Small states |         35        1.20       81.93
                             South Asia |         35        1.20       83.13
                South Asia (IDA & IBRD) |         35        1.20       84.34
                            South Sudan |         35        1.20       85.54
                    St. Kitts and Nevis |         35        1.20       86.75
                              St. Lucia |         35        1.20       87.95
               St. Martin (French part) |         35        1.20       89.16
         St. Vincent and the Grenadines |         35        1.20       90.36
                     Sub-Saharan Africa |         35        1.20       91.57
Sub-Saharan Africa (IDA & IBRD countr.. |         35        1.20       92.77
Sub-Saharan Africa (excluding high in.. |         35        1.20       93.98
               Turks and Caicos Islands |         35        1.20       95.18
                    Upper middle income |         35        1.20       96.39
                  Virgin Islands (U.S.) |         35        1.20       97.59
                     West Bank and Gaza |         35        1.20       98.80
                                  World |         35        1.20      100.00
----------------------------------------+-----------------------------------
                                  Total |      2,905      100.00

.                         drop if cow==.
(2,905 observations deleted)

.                         drop n TimeCode  country

.                         sum

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
        year |      6,405        2003    10.10029       1986       2020
 wdi_country |          0
   wdi_ccode |          0
Accesstoel~u |      4,700    78.88365    30.71099   .5338985        100
GDPpercapi~S |      5,888    12007.04    18774.63   160.6871   183244.6
-------------+---------------------------------------------------------
GDPpercapi~l |      5,961    1.769845    6.235446  -64.99237    140.367
Population~P |      6,391    1.560304    1.485374  -6.766133   17.51221
Population~L |      6,393    3.44e+07    1.29e+08       8341   1.41e+09
Povertyh~190 |      1,657    9.969282    17.57069          0       94.3
Mobilecell~p |      6,191    45.18938    51.71374          0    212.639
-------------+---------------------------------------------------------
Mortality~10 |      6,188    51.81277    55.40999        1.7      337.4
Mortalit~100 |      6,188    36.03887    33.45988        1.5      176.5
Oilrentsof~T |      5,679    3.753947     9.33111          0   66.71276
Fixedbroad~p |      3,147    9.417508    12.30702          0   53.20065
Naturalgas~Y |      5,671    .5619302    2.999983          0   68.56375
-------------+---------------------------------------------------------
     cowcode |      6,405    471.3279     260.904          2        990

.                         order cow year wdi*

.                         gen lpop = ln(Populationtotal)
(12 missing values generated)

.                         hist GDPpercapitaconstant2015US
(bin=37, start=160.68714, width=4948.2142)

.                         gen loggdppc = ln(GDPpercapitaconstant2015US)
(517 missing values generated)

.                         gen gdppc = GDPpercapitaconstant2015US^.5  
(517 missing values generated)

.                         sfrancia GDPpercapitaconstant2015US loggdppc gdppc  /* sq
> rt is more normal than raw or log */ 

                  Shapiro–Francia W' test for normal data

    Variable |       Obs       W'          V'        z       Prob>z
-------------+-----------------------------------------------------
GDPpercapi~S |     5,888    0.63461   1242.603    18.228    0.00001
    loggdppc |     5,888    0.97949     69.742    10.860    0.00001
       gdppc |     5,888    0.84887    513.951    15.969    0.00001

Note: The normal approximation to the sampling distribution of W'
      is valid for 10<=n<=5000 under the log transformation.

.                         gen imr =sqrt(Mortalityrateinfantper100)
(217 missing values generated)

.                         sfrancia Mortalityrateinfantper100 imr

                  Shapiro–Francia W' test for normal data

    Variable |       Obs       W'          V'        z       Prob>z
-------------+-----------------------------------------------------
Mortalit~100 |     6,188    0.85969    499.764    15.946    0.00001
         imr |     6,188    0.95077    175.342    13.258    0.00001

Note: The normal approximation to the sampling distribution of W'
      is valid for 10<=n<=5000 under the log transformation.

.                         tsset cow year

Panel variable: cowcode (strongly balanced)
 Time variable: year, 1986 to 2020
         Delta: 1 unit

.                         gen gr = GDPpercapitagrowthannual
(444 missing values generated)

.                         tssmooth ma l12gr  = GDPpercapitagrowthannual, window(2 0
>  0)
The smoother applied was
     by cowcode : (1/2)*[x(t-2) + x(t-1) + 0*x(t)]; x(t)=
     GDPpercapitagrowthannual

.                         tssmooth ma l1gr  = GDPpercapitagrowthannual, window(1 0 
> 0)
The smoother applied was
     by cowcode : (1/1)*[x(t-1) + 0*x(t)]; x(t)= GDPpercapitagrowthannual

.                         gen oilgasrentsgdp =  ln(1+OilrentsofGDPNYGDPPET + Natura
> lgasrentsofGDPNY)
(734 missing values generated)

.                         gen mobilephone=sqrt(Mobilecellularsubscriptionsp/1000000
> )
(214 missing values generated)

.                         sort cow year

.                         save wdi-merge2,replace
(file wdi-merge2.dta not found)
file wdi-merge2.dta saved

.         
.                 * VDem data * /* downloaded 4.06.2021 from https://www.v-dem.net/
> en/data/data/v-dem-dataset-v111/ */
.                         use V-Dem-CY-Full+Others-v111,clear
(V-Dem CY-Full+Others)

.                         keep country_name year COWcode v2x_polyarchy v2x_libdem v
> 2x_partipdem v2x_freexp_altinf v2x_frassoc_thick ///
>                                 v2x_clpol v2x_civlib v2x_clpriv v2x_clphy v2csrep
> rss v2xlg_legcon v2dlencmps v2cltort v2clkill v2x_corr ///
>                                 v2juhccomp v2jupack v2jupurge v2jupoatck v2jurefo
> rm v2x_jucon v2juhcind  ///
>                                 v2smgovfilprc* v2smgovsmcenprc* v2smgovsmmon* v2s
> mgovsm* v2smgovshut* v2smgovsmalt* v2smgovdom v2smpardom v2smcamp ///
>                                 v2smregapp  v2smpolhate v2smonper v2smorgavgact v
> 2smonex v2smorgelitact v2caassemb v2cseeorgs v2casoe* ///
>                                 v2smgovfilprc v2smgovsmcenprc v2smgovsmmon v2smgo
> vsm v2smgovshut v2smgovcapsec v2smgovshutcap v2smgovfilcap v2smregcap ///
>                                 e_civil_war e_migdppcln e_migdpgro e_wbgi_gee e_w
> bgi_pve e_v2xel_frefair_3C e_v2xcl_rol_3C ///
>                                 v2xel_elecpres v2xel_elecparl v2xps_party v2x_reg
> ime v2exl_legitlead* v2exl_legitperf v2exl_legitideol ///
>                                 v2cacamps* v2smpolsoc* v2elpubfin_ord ///
>                                 v2stfisccap v2clrspct v2x_pubcorr v2cltrnslw v2st
> critrecadm v2stcritapparm v2strenadm v2strenarm v2peasbepol v2peasjpol ///
>                                 v3stcensus v3stnatbank v3ststatag v3ststybcov v3s
> tstybpub ///
>                                 v2lpname v2elvotlrg v2elloelsy v2ellostlg v2ellos
> tsl v2ellostss v2elparlel v2elthresh ///
>                                 v2exrescon v2regimpgroup v2regsupgroups* v2pscohe
> sv v2lginvstp v2lgotovst v2lgoppart ///
>                                 v2exbribe v2exembez v2x_execorr v2cagenmob v2cade
> mmob v2caautmob v2caviol v2csprtcpt ///
>                                 v2elaccept v2elturnhog v2elturnhos v2eltvrexo v2e
> lpeace v2eldonate v2elpubfin v2el*

.                         rename country_name vdem_country

.                         rename COWcode cowcode

.                         recode cow (679=678) if year>1990
(30 changes made to cowcode)

.                         tab vdem_country if cow==.

                    Country name |      Freq.     Percent        Cum.
---------------------------------+-----------------------------------
                       Brunswick |         74        9.81        9.81
                         Hamburg |         79       10.48       20.29
                       Hong Kong |        121       16.05       36.34
                          Nassau |         61        8.09       44.43
                       Oldenburg |         77       10.21       54.64
       Palestine/British Mandate |         31        4.11       58.75
                  Palestine/Gaza |         33        4.38       63.13
             Palestine/West Bank |         56        7.43       70.56
               Piedmont-Sardinia |         73        9.68       80.24
            Saxe-Weimar-Eisenach |         59        7.82       88.06
                      Somaliland |         90       11.94      100.00
---------------------------------+-----------------------------------
                           Total |        754      100.00

.                         drop if cow==.
(754 observations deleted)

.                         tab vdem_country if cowcode==99999   /* cases in our samp
> le */
no observations

.                         drop if cowcode==99999
(0 observations deleted)

.                         replace v2x_clphy= (v2x_clphy*-1) +1/* flip scale so it m
> easures repression instead of human rights respect */
(26,243 real changes made)

.                                 * Impersonal state bureaucracy *
.                                 gsem  (PER-> v2clrspct v2stcritrecadm v2strenadm 
> v2x_pubcorr v2cltrnslw,fam(gaussian)link(id) ///
>                                         var(PER@1)vce(cluster cowcode))

Fitting fixed-effects model:

Iteration 0:  Log likelihood = -180575.63  
Iteration 1:  Log likelihood = -180575.63  

Refining starting values:

Grid node 0:  Log likelihood = -152794.26

Fitting full model:

Iteration 0:  Log pseudolikelihood = -152794.26  
Iteration 1:  Log pseudolikelihood = -150328.96  
Iteration 2:  Log pseudolikelihood =  -150206.4  
Iteration 3:  Log pseudolikelihood = -150206.33  
Iteration 4:  Log pseudolikelihood = -150206.33  

Generalized structural equation model                   Number of obs = 26,118

Response: v2clrspct                                     Number of obs = 25,981
Family:   Gaussian      
Link:     Identity      

Response: v2stcritrecadm                                Number of obs = 24,599
Family:   Gaussian      
Link:     Identity      

Response: v2strenadm                                    Number of obs = 24,614
Family:   Gaussian      
Link:     Identity      

Response: v2x_pubcorr                                   Number of obs = 25,709
Family:   Gaussian      
Link:     Identity      

Response: v2cltrnslw                                    Number of obs = 25,810
Family:   Gaussian      
Link:     Identity      

Log pseudolikelihood = -150206.33

 ( 1)  [/]var(PER) = 1
                                  (Std. err. adjusted for 194 clusters in cowcode)
----------------------------------------------------------------------------------
                 |               Robust
                 | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
-----------------+----------------------------------------------------------------
v2clrspct        |
             PER |   1.358578   .0611003    22.24   0.000     1.238824    1.478333
           _cons |  -.0575086   .0976621    -0.59   0.556    -.2489228    .1339057
-----------------+----------------------------------------------------------------
v2stcritrecadm   |
             PER |   .9120737   .0690884    13.20   0.000     .7766629    1.047484
           _cons |   .0446993   .0848219     0.53   0.598    -.1215485    .2109471
-----------------+----------------------------------------------------------------
v2strenadm       |
             PER |     .53999   .0657707     8.21   0.000     .4110818    .6688981
           _cons |   .4080815   .0804473     5.07   0.000     .2504076    .5657553
-----------------+----------------------------------------------------------------
v2x_pubcorr      |
             PER |  -.2069639   .0117816   -17.57   0.000    -.2300555   -.1838723
           _cons |   .4274895   .0202353    21.13   0.000     .3878291    .4671499
-----------------+----------------------------------------------------------------
v2cltrnslw       |
             PER |   1.262677   .0670595    18.83   0.000     1.131243    1.394111
           _cons |   .0072041   .0957703     0.08   0.940    -.1805022    .1949104
-----------------+----------------------------------------------------------------
         var(PER)|          1  (constrained)
-----------------+----------------------------------------------------------------
 var(e.v2clrspct)|   .3104884   .0545709                      .2200086    .4381784
var(e.v2stcri~dm)|   .9049932   .0736705                      .7715315    1.061542
var(e.v2strenadm)|   1.301452   .1217614                      1.083406    1.563381
var(e.v2x_pubc~r)|   .0419295   .0033425                      .0358645    .0490202
var(e.v2cltrnslw)|   .5429325   .0595069                      .4379775    .6730385
----------------------------------------------------------------------------------

.                                 predict vburcap,ebmeans latent se(se_vburcap)
(using 7 quadrature points)

.                                 * Polarization *                                
.                                 desc v2cacamps v2smpolsoc                       

Variable      Storage   Display    Value
    name         type    format    label      Variable label
-----------------------------------------------------------------------------------
v2cacamps       double  %9.0g                 Political polarization
v2smpolsoc      double  %9.0g                 Polarization of society

.                                 gen polarization=v2cacamps
(8,749 missing values generated)

.                         tsset cow year

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit

.                         sort cowcode year

.                         global vA="v2x_polyarchy v2x_libdem v2x_partipdem v2x_clp
> riv v2x_freexp_altinf v2x_frassoc_thick v2elpubfin_ord"

.                         global vB="v2lpname v2elvotlrg v2elloelsy  v2elparlel v2e
> lthresh v2ellostsl v2ellostss v2xps_party v2pscohesv"

.                         global vC=" v2exrescon v2casoe_0 v2casoe_1 v2exbribe v2ex
> embez v2x_execorr v2lginvstp v2lgotovst v2lgoppart v2xlg_legcon"

.                         global vD="v2x_clpol v2x_clphy v2x_civlib v2caassemb v2cs
> eeorgs v2csprtcpt v2csreprss v2smgovdom v2smpardom"

.                         global vE="v2cagenmob v2cademmob v2caautmob v2caviol vbur
> cap polarization v2x_jucon v2juhcind v2eldonate v2elpubfin"

.                         local var = "$vA $vB $vC $vD $vE"

.                         foreach v of local var {
  2.                                 tsset cow year
  3.                                 gen l1`v'=l1.`v' 
  4.                                 gen l2`v'=l2.`v' 
  5.                                 gen l3`v'=l3.`v' 
  6.                                 gen l4`v'=l4.`v' 
  7.                         }

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(1,624 missing values generated)
(1,843 missing values generated)
(2,058 missing values generated)
(2,272 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(2,611 missing values generated)
(2,825 missing values generated)
(3,035 missing values generated)
(3,244 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(2,017 missing values generated)
(2,231 missing values generated)
(2,441 missing values generated)
(2,650 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(407 missing values generated)
(628 missing values generated)
(845 missing values generated)
(1,061 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(886 missing values generated)
(1,107 missing values generated)
(1,324 missing values generated)
(1,540 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(971 missing values generated)
(1,192 missing values generated)
(1,409 missing values generated)
(1,625 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(1,201 missing values generated)
(1,418 missing values generated)
(1,631 missing values generated)
(1,843 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(26,438 missing values generated)
(26,438 missing values generated)
(26,438 missing values generated)
(26,438 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(25,212 missing values generated)
(25,238 missing values generated)
(25,262 missing values generated)
(25,278 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(23,518 missing values generated)
(23,562 missing values generated)
(23,603 missing values generated)
(23,634 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(22,827 missing values generated)
(22,872 missing values generated)
(22,913 missing values generated)
(22,945 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(23,422 missing values generated)
(23,467 missing values generated)
(23,508 missing values generated)
(23,542 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(23,399 missing values generated)
(23,437 missing values generated)
(23,477 missing values generated)
(23,510 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(23,621 missing values generated)
(23,659 missing values generated)
(23,698 missing values generated)
(23,731 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(9,768 missing values generated)
(9,955 missing values generated)
(10,143 missing values generated)
(10,332 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(3,335 missing values generated)
(3,545 missing values generated)
(3,752 missing values generated)
(3,958 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(1,879 missing values generated)
(2,094 missing values generated)
(2,305 missing values generated)
(2,515 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(8,337 missing values generated)
(8,528 missing values generated)
(8,717 missing values generated)
(8,906 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(8,337 missing values generated)
(8,528 missing values generated)
(8,717 missing values generated)
(8,906 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(921 missing values generated)
(1,142 missing values generated)
(1,359 missing values generated)
(1,575 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(1,089 missing values generated)
(1,309 missing values generated)
(1,525 missing values generated)
(1,740 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(1,089 missing values generated)
(1,309 missing values generated)
(1,525 missing values generated)
(1,740 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(7,780 missing values generated)
(7,978 missing values generated)
(8,176 missing values generated)
(8,373 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(7,676 missing values generated)
(7,875 missing values generated)
(8,075 missing values generated)
(8,274 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(9,645 missing values generated)
(9,832 missing values generated)
(10,019 missing values generated)
(10,207 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(7,786 missing values generated)
(7,984 missing values generated)
(8,182 missing values generated)
(8,379 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(711 missing values generated)
(932 missing values generated)
(1,149 missing values generated)
(1,365 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(411 missing values generated)
(632 missing values generated)
(849 missing values generated)
(1,065 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(721 missing values generated)
(942 missing values generated)
(1,159 missing values generated)
(1,375 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(8,879 missing values generated)
(9,069 missing values generated)
(9,256 missing values generated)
(9,443 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(670 missing values generated)
(891 missing values generated)
(1,108 missing values generated)
(1,324 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(860 missing values generated)
(1,080 missing values generated)
(1,296 missing values generated)
(1,511 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(838 missing values generated)
(1,059 missing values generated)
(1,276 missing values generated)
(1,492 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(22,949 missing values generated)
(23,124 missing values generated)
(23,299 missing values generated)
(23,474 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(22,949 missing values generated)
(23,124 missing values generated)
(23,299 missing values generated)
(23,474 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(9,260 missing values generated)
(9,450 missing values generated)
(9,636 missing values generated)
(9,821 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(9,542 missing values generated)
(9,731 missing values generated)
(9,915 missing values generated)
(10,099 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(9,452 missing values generated)
(9,641 missing values generated)
(9,826 missing values generated)
(10,011 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(8,928 missing values generated)
(9,118 missing values generated)
(9,305 missing values generated)
(9,492 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(225 missing values generated)
(447 missing values generated)
(665 missing values generated)
(882 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(8,936 missing values generated)
(9,126 missing values generated)
(9,313 missing values generated)
(9,500 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(1,834 missing values generated)
(2,049 missing values generated)
(2,260 missing values generated)
(2,470 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(4,103 missing values generated)
(4,309 missing values generated)
(4,512 missing values generated)
(4,715 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(1,189 missing values generated)
(1,406 missing values generated)
(1,619 missing values generated)
(1,831 missing values generated)

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit
(1,201 missing values generated)
(1,418 missing values generated)
(1,631 missing values generated)
(1,843 missing values generated)

.                         
.                         sum year cow

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
        year |     26,438    1928.265     63.4072       1789       2020
     cowcode |     26,438    443.1664    249.8978          2        950

.                         xtset cow year

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit

.                         alpha v2clkill v2cltort if year>=1990, item std gen(vkill
> )
note: option item ignored with 2 variables

Test scale = mean(standardized items)

Average interitem correlation:      0.8853
Number of items in the scale:            2
Scale reliability coefficient:      0.9392

.                         replace vkill = vkill*-1
(5,382 real changes made)

.                         
.                         gen vdem_democracy=v2x_regime>=2 & v2x_regime!=.

.                         tab vdem_democracy

vdem_democr |
        acy |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |     21,609       81.73       81.73
          1 |      4,829       18.27      100.00
------------+-----------------------------------
      Total |     26,438      100.00

.                         tsset cow year

Panel variable: cowcode (unbalanced)
 Time variable: year, 1789 to 2020, but with gaps
         Delta: 1 unit

.                         gen l1vdem_democracy = l.vdem_democracy
(225 missing values generated)

.                         gen enddem = vdem_democracy==0 & l1vdem_democracy==1

.                         
.                          ** 
.                          recode cow (679=678) if year==1990 & vdem_country=="Yeme
> n"
(1 changes made to cowcode)

.                          recode cow (260=255) if year>1945 & year<=1990 & vdem_co
> untry=="Germany"
(42 changes made to cowcode)

.                          recode cow (316=315) if year==1993 & vdem_country=="Czec
> h Republic"
(1 changes made to cowcode)

.  
.                         * Merge GWF data *
.                         sort cow year

.                         merge cow year using "GWFglobal2020.dta"
(you are using old merge syntax; see [D] merge for new syntax)

.                         sum year if v2x_polyarchy~=.

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
        year |     25,035    1932.781    61.38212       1789       2020

.                         sum year if gwf_country ~=""

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
        year |      9,367    1987.082    20.61321       1946       2020

.                         tab _merge if year>=1988  & year<=2019  /* All GWF data i
> n the data set */

     _merge |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |        846       15.33       15.33
          3 |      4,672       84.67      100.00
------------+-----------------------------------
      Total |      5,518      100.00

.                         drop if _merge==1
(17,071 observations deleted)

.                         rename _merge merge1

.                         sum v2smgovfilprc v2smgovsmcenprc v2smgovsmmon v2smgovsm 
> v2smgovshut v2smgovcapsec ///
>                                 v2smgovshutcap v2smgovfilcap v2smregcap if year<2
> 000

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
v2smgovfil~c |          0
v2smgovsmc~c |          0
v2smgovsmmon |          0
   v2smgovsm |          0
 v2smgovshut |          0
-------------+---------------------------------------------------------
v2smgovcap~c |          0
v2smgovsh~ap |          0
v2smgovfi~ap |          0
  v2smregcap |          0

.                         keep if year>=1988 & year<=2020
(4,545 observations deleted)

.                         
.                         xtset cow year

Panel variable: cowcode (unbalanced)
 Time variable: year, 1988 to 2020, but with a gap
         Delta: 1 unit

.                         sort cow year

.                         merge cow year using wdi-merge2
(you are using old merge syntax; see [D] merge for new syntax)

.                         tab _merge

     _merge |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |        161        2.45        2.45
          2 |      1,744       26.56       29.01
          3 |      4,661       70.99      100.00
------------+-----------------------------------
      Total |      6,566      100.00

.                         rename _merge merge2

.                         tab gwf_country if merge2==1 /* note that South Sudan, Sw
> aziland, and Taiwan (2000) are missing from WDI */

               Country |      Freq.     Percent        Cum.
-----------------------+-----------------------------------
        Czechoslovakia |          6        3.73        3.73
          Germany East |          3        1.86        5.59
           Korea North |         33       20.50       26.09
                Kosovo |         12        7.45       33.54
             Macedonia |         29       18.01       51.55
           South Sudan |          9        5.59       57.14
           South Yemen |          3        1.86       59.01
             Swaziland |         33       20.50       79.50
                Taiwan |         33       20.50      100.00
-----------------------+-----------------------------------
                 Total |        161      100.00

.                         tab wdi_country if merge2==2

                           Country Name |      Freq.     Percent        Cum.
----------------------------------------+-----------------------------------
                            Afghanistan |          2        0.11        0.11
                                Albania |          2        0.11        0.23
                                Algeria |          2        0.11        0.34
                                Andorra |         35        2.01        2.35
                                 Angola |          2        0.11        2.47
                    Antigua and Barbuda |         35        2.01        4.47
                              Argentina |          2        0.11        4.59
                                Armenia |          6        0.34        4.93
                              Australia |          2        0.11        5.05
                                Austria |          2        0.11        5.16
                             Azerbaijan |          6        0.34        5.50
                           Bahamas, The |         35        2.01        7.51
                                Bahrain |         35        2.01        9.52
                             Bangladesh |          2        0.11        9.63
                               Barbados |         35        2.01       11.64
                                Belarus |          6        0.34       11.98
                                Belgium |          2        0.11       12.10
                                 Belize |         35        2.01       14.11
                                  Benin |          2        0.11       14.22
                                 Bhutan |         35        2.01       16.23
                                Bolivia |          2        0.11       16.34
                 Bosnia and Herzegovina |          7        0.40       16.74
                               Botswana |          2        0.11       16.86
                                 Brazil |          2        0.11       16.97
                      Brunei Darussalam |         35        2.01       18.98
                               Bulgaria |          2        0.11       19.09
                           Burkina Faso |          2        0.11       19.21
                                Burundi |          2        0.11       19.32
                               Cambodia |          2        0.11       19.44
                               Cameroon |          2        0.11       19.55
                                 Canada |          2        0.11       19.67
               Central African Republic |          2        0.11       19.78
                                   Chad |          2        0.11       19.90
                                  Chile |          2        0.11       20.01
                                  China |          2        0.11       20.13
                               Colombia |          2        0.11       20.24
                                Comoros |         35        2.01       22.25
                       Congo, Dem. Rep. |          2        0.11       22.36
                            Congo, Rep. |          2        0.11       22.48
                             Costa Rica |          2        0.11       22.59
                          Cote d'Ivoire |          2        0.11       22.71
                                Croatia |          6        0.34       23.05
                                   Cuba |          2        0.11       23.17
                                 Cyprus |         35        2.01       25.17
                         Czech Republic |          8        0.46       25.63
                                Denmark |          2        0.11       25.75
                               Djibouti |         35        2.01       27.75
                               Dominica |         35        2.01       29.76
                     Dominican Republic |          2        0.11       29.87
                                Ecuador |          2        0.11       29.99
                       Egypt, Arab Rep. |          2        0.11       30.10
                            El Salvador |          2        0.11       30.22
                      Equatorial Guinea |         35        2.01       32.22
                                Eritrea |          8        0.46       32.68
                                Estonia |          6        0.34       33.03
                               Ethiopia |          2        0.11       33.14
                                   Fiji |         35        2.01       35.15
                                Finland |          2        0.11       35.26
                                 France |          2        0.11       35.38
                                  Gabon |          2        0.11       35.49
                            Gambia, The |          2        0.11       35.61
                                Georgia |          6        0.34       35.95
                                Germany |          2        0.11       36.07
                                  Ghana |          2        0.11       36.18
                                 Greece |          2        0.11       36.30
                                Grenada |         35        2.01       38.30
                              Guatemala |          2        0.11       38.42
                                 Guinea |          2        0.11       38.53
                          Guinea-Bissau |          2        0.11       38.65
                                 Guyana |         35        2.01       40.65
                                  Haiti |          2        0.11       40.77
                               Honduras |          2        0.11       40.88
                                Hungary |          2        0.11       41.00
                                Iceland |          2        0.11       41.11
                                  India |          2        0.11       41.23
                              Indonesia |          2        0.11       41.34
                     Iran, Islamic Rep. |          2        0.11       41.46
                                   Iraq |          2        0.11       41.57
                                Ireland |          2        0.11       41.69
                                 Israel |          2        0.11       41.80
                                  Italy |          2        0.11       41.92
                                Jamaica |         35        2.01       43.92
                                  Japan |          2        0.11       44.04
                                 Jordan |          2        0.11       44.15
                             Kazakhstan |          6        0.34       44.50
                                  Kenya |          2        0.11       44.61
                               Kiribati |         35        2.01       46.62
                            Korea, Rep. |          2        0.11       46.73
                                 Kuwait |          2        0.11       46.85
                        Kyrgyz Republic |          6        0.34       47.19
                                Lao PDR |          2        0.11       47.31
                                 Latvia |          6        0.34       47.65
                                Lebanon |          2        0.11       47.76
                                Lesotho |          2        0.11       47.88
                                Liberia |          2        0.11       47.99
                                  Libya |          2        0.11       48.11
                          Liechtenstein |         35        2.01       50.11
                              Lithuania |          6        0.34       50.46
                             Luxembourg |         35        2.01       52.47
                             Madagascar |          2        0.11       52.58
                                 Malawi |          2        0.11       52.69
                               Malaysia |          2        0.11       52.81
                               Maldives |         35        2.01       54.82
                                   Mali |          2        0.11       54.93
                                  Malta |         35        2.01       56.94
                       Marshall Islands |         35        2.01       58.94
                             Mauritania |          2        0.11       59.06
                              Mauritius |          2        0.11       59.17
                                 Mexico |          2        0.11       59.29
                                Moldova |          6        0.34       59.63
                                 Monaco |         35        2.01       61.64
                               Mongolia |          2        0.11       61.75
                                Morocco |          2        0.11       61.87
                             Mozambique |          2        0.11       61.98
                                Myanmar |          2        0.11       62.10
                                Namibia |          5        0.29       62.39
                                  Nauru |         35        2.01       64.39
                                  Nepal |          2        0.11       64.51
                            Netherlands |          2        0.11       64.62
                            New Zealand |          2        0.11       64.74
                              Nicaragua |          2        0.11       64.85
                                  Niger |          2        0.11       64.97
                                Nigeria |          2        0.11       65.08
                                 Norway |          2        0.11       65.19
                                   Oman |          2        0.11       65.31
                               Pakistan |          2        0.11       65.42
                                  Palau |         35        2.01       67.43
                                 Panama |          2        0.11       67.55
                       Papua New Guinea |         35        2.01       69.55
                               Paraguay |          2        0.11       69.67
                                   Peru |          2        0.11       69.78
                            Philippines |          2        0.11       69.90
                                 Poland |          2        0.11       70.01
                               Portugal |          2        0.11       70.13
                                  Qatar |         35        2.01       72.13
                                Romania |          2        0.11       72.25
                     Russian Federation |          2        0.11       72.36
                                 Rwanda |          2        0.11       72.48
                                  Samoa |         35        2.01       74.48
                             San Marino |         35        2.01       76.49
                  Sao Tome and Principe |         35        2.01       78.50
                           Saudi Arabia |          2        0.11       78.61
                                Senegal |          2        0.11       78.73
                                 Serbia |          3        0.17       78.90
                             Seychelles |         35        2.01       80.91
                           Sierra Leone |          2        0.11       81.02
                              Singapore |          2        0.11       81.14
                        Slovak Republic |          8        0.46       81.59
                               Slovenia |          6        0.34       81.94
                        Solomon Islands |         35        2.01       83.94
                                Somalia |          2        0.11       84.06
                           South Africa |          2        0.11       84.17
                                  Spain |          2        0.11       84.29
                              Sri Lanka |          2        0.11       84.40
                                  Sudan |          2        0.11       84.52
                               Suriname |         35        2.01       86.53
                                 Sweden |          2        0.11       86.64
                            Switzerland |          2        0.11       86.75
                   Syrian Arab Republic |          2        0.11       86.87
                             Tajikistan |          6        0.34       87.21
                               Tanzania |          2        0.11       87.33
                               Thailand |          2        0.11       87.44
                            Timor-Leste |         35        2.01       89.45
                                   Togo |          2        0.11       89.56
                                  Tonga |         35        2.01       91.57
                    Trinidad and Tobago |         35        2.01       93.58
                                Tunisia |          2        0.11       93.69
                                 Turkey |          2        0.11       93.81
                           Turkmenistan |          6        0.34       94.15
                                 Tuvalu |         35        2.01       96.16
                                 Uganda |          2        0.11       96.27
                                Ukraine |          6        0.34       96.62
                   United Arab Emirates |          2        0.11       96.73
                         United Kingdom |          2        0.11       96.85
                          United States |          2        0.11       96.96
                                Uruguay |          2        0.11       97.08
                             Uzbekistan |          6        0.34       97.42
                                Vanuatu |         35        2.01       99.43
                          Venezuela, RB |          2        0.11       99.54
                                Vietnam |          2        0.11       99.66
                            Yemen, Rep. |          2        0.11       99.77
                                 Zambia |          2        0.11       99.89
                               Zimbabwe |          2        0.11      100.00
----------------------------------------+-----------------------------------
                                  Total |      1,744      100.00

.                         drop if merge2==2
(1,744 observations deleted)

.                         replace cow =626 if gwf_country=="South Sudan"
(0 real changes made)

.                         xtset cow year

Panel variable: cowcode (unbalanced)
 Time variable: year, 1988 to 2020, but with a gap
         Delta: 1 unit

.                         gen l1gdp =l.gdp
(528 missing values generated)

.                         sort cowcode year

.                         merge cowcode year using fariss-merge
(you are using old merge syntax; see [D] merge for new syntax)

.                         tab _merge  /* no issues merging */

     _merge |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |        458        3.76        3.76
          2 |      7,353       60.39       64.16
          3 |      4,364       35.84      100.00
------------+-----------------------------------
      Total |     12,175      100.00

.                         drop if _merge==2
(7,353 observations deleted)

.                         rename _merge merge4

.                         sort cowcode year

.                         merge cowcode year using prio-mergeB
(you are using old merge syntax; see [D] merge for new syntax)

.                         tab _merge

     _merge |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |      3,869       67.25       67.25
          2 |        931       16.18       83.43
          3 |        953       16.57      100.00
------------+-----------------------------------
      Total |      5,753      100.00

.                         rename _merge merge5

.                         drop if year<1988
(911 observations deleted)

.                         tab merge5

     merge5 |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |      3,869       79.90       79.90
          2 |         20        0.41       80.32
          3 |        953       19.68      100.00
------------+-----------------------------------
      Total |      4,842      100.00

.                         sum year if merge5==2  /* all in 2018 */

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
        year |         20     1994.45    5.744334       1989       2011

.                         drop if merge5==2
(20 observations deleted)

.                         recode prio_conflict* prio_lconflict* (.=0) if year<=2018
(3,604 changes made to prio_conflict_intra)
(3,604 changes made to prio_conflict_inter)
(3,604 changes made to prio_conflict_duration_intra)
(3,604 changes made to prio_conflict_duration_inter)
(3,604 changes made to prio_conflict_cumint_intra)
(3,604 changes made to prio_conflict_cumint_inter)
(3,604 changes made to prio_conflict_int_intra)
(3,604 changes made to prio_conflict_int_inter)
(3,604 changes made to prio_lconflict_int_intra)
(3,604 changes made to prio_lconflict_int_inter)
(3,604 changes made to prio_lconflict_intra)
(3,604 changes made to prio_lconflict_inter)
(3,604 changes made to prio_lconflict_duration_intra)
(3,604 changes made to prio_lconflict_duration_inter)
(3,604 changes made to prio_lconflict_cumint_intra)
(3,604 changes made to prio_lconflict_cumint_inter)

.                         sort cowcode year

.                         save master,replace
(file master.dta not found)
file master.dta saved

.                         
.                         insheet   using "reign-regime.csv",clear
(6 vars, 617 obs)

.                         gen sdate = date(gwf_startdate, "MDY")

.                         gen edate = date(gwf_enddate, "MDY")

.                         gen syear = year(sdate)

.                         gen eyear = year(edate)

.                         gen duration = eyear-syear +1

.                         expand duration
(13,106 observations created)

.                         gen n=_n

.                         egen m = min(n),by(gwf_casename)

.                         gen year =syear+1 if m==n
(13,106 missing values generated)

.                         sort gwf_casename year

.                         replace year = year[_n-1]+1 if year==.
(13,106 real changes made)

.                         drop if year>eyear & year<=2019 & gwf_enddate~="12/31/201
> 9"
(416 observations deleted)

.                         drop if year==2020 & gwf_enddate~="12/31/2019"
(7 observations deleted)

.                         keep if year>1987 & year<=2020
(7,051 observations deleted)

.                         recode cowcode (679=678) if year>=1991
(30 changes made to cowcode)

.                         recode cowcode (316=315) if year==1993
(1 changes made to cowcode)

.                         recode cowcode (260=255) if year<=1990
(3 changes made to cowcode)

.                         local var = "country startdate enddate regimetype casenam
> e"

.                         foreach v of local var {
  2.                                 rename gwf_`v' reign_`v'
  3.                         }

.                         sort cow year

.                         xtset cowcode year

Panel variable: cowcode (unbalanced)
 Time variable: year, 1988 to 2020
         Delta: 1 unit

.                         merge cow year using master
(you are using old merge syntax; see [D] merge for new syntax)
(variable year was float, now double to accommodate using data's values)
(variable cowcode was int, now double to accommodate using data's values)
(label elaccept_ord already defined)
(label elasmoff_ord already defined)
(label elboycot_ord already defined)
(label eldonate_ord already defined)
(label elembaut_ord already defined)
(label elembcap_ord already defined)
(label elffelr_ord already defined)
(label elffelrbin_ord already defined)
(label elfrcamp_ord already defined)
(label elfrfair_ord already defined)
(label elintim_ord already defined)
(label elirreg_ord already defined)
(label ellocelc already defined)
(label ellocgov already defined)
(label ellocpwr_ord already defined)
(label elmulpar_ord already defined)
(label elpaidig_ord already defined)
(label elpdcamp_ord already defined)
(label elpeace_ord already defined)
(label elpubfin_ord already defined)
(label elreggov already defined)
(label elrgpwr_ord already defined)
(label elrgstry_ord already defined)
(label elrstrct already defined)
(label elsnlsff_ord already defined)
(label elsrgel already defined)
(label eltvrexo already defined)
(label eltvrig already defined)
(label elvotbuy_ord already defined)
(label x_regime already defined)
(label exl_legitlead_ord already defined)
(label smgovfilprc_ord already defined)
(label smpolsoc_ord already defined)
(label regsupgroupssize_ord already defined)
(label smgovsmalt_ord already defined)
(label smgovshutcap_ord already defined)
(label smgovshut_ord already defined)
(label smgovsm_ord already defined)
(label smgovsmmon_ord already defined)
(label smgovsmcenprc_ord already defined)
(label v2cacamps_ord_labels already defined)
(label v2regimpgroup_label already defined)

.                         tab _merge

     _merge |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |      1,461       23.25       23.25
          2 |         34        0.54       23.79
          3 |      4,788       76.21      100.00
------------+-----------------------------------
      Total |      6,283      100.00

.                         tab gwf_country if _merge==2  /* Taiwan not in reign data
>  */

               Country |      Freq.     Percent        Cum.
-----------------------+-----------------------------------
               Hungary |          1        2.94        2.94
                Taiwan |         33       97.06      100.00
-----------------------+-----------------------------------
                 Total |         34      100.00

.                         drop if _merge==1
(1,461 observations deleted)

.                         rename _merge merge6

.                         drop sdate edate syear eyear duration n m

.                         sort cowcode year

.                         save master, replace
file master.dta saved

.                         
.                         insheet using "Claassen-Support-Democracy.csv",clear  /* 
> 1987--2017 coverage */
(5 vars, 4,185 obs)

.                         replace supdem ="." if supdem=="NA"
(1,615 real changes made)

.                         replace lsupdem="." if lsupdem=="NA"
(1,750 real changes made)

.                         destring supdem lsupdem,replace
supdem: all characters numeric; replaced as double
(1615 missing values generated)
lsupdem: all characters numeric; replaced as double
(1750 missing values generated)

.                         rename country supdem_country

.                         sum

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
supdem_cou~y |          0
        year |      4,185        2002    8.945341       1987       2017
      supdem |      2,570    .0302308    .8883788  -2.103393   2.740774
     lsupdem |      2,435    .0355379    .8880985  -2.103393   2.740774
     cowcode |      4,185    432.7704    231.8774          2        920

.                         xtset cowcode year

Panel variable: cowcode (strongly balanced)
 Time variable: year, 1987 to 2017
         Delta: 1 unit

.                         gen l1supdem = lsupdem
(1,750 missing values generated)

.                         gen l2supdem = l.lsupdem
(1,885 missing values generated)

.                         gen l3supdem = l2.lsupdem
(2,020 missing values generated)

.                         gen l4supdem = l3.lsupdem
(2,155 missing values generated)

.                         
.                         sort cowcode year

.                         merge cowcode year using master
(you are using old merge syntax; see [D] merge for new syntax)
(variable cowcode was int, now double to accommodate using data's values)
(variable year was int, now double to accommodate using data's values)
(label elaccept_ord already defined)
(label elasmoff_ord already defined)
(label elboycot_ord already defined)
(label eldonate_ord already defined)
(label elembaut_ord already defined)
(label elembcap_ord already defined)
(label elffelr_ord already defined)
(label elffelrbin_ord already defined)
(label elfrcamp_ord already defined)
(label elfrfair_ord already defined)
(label elintim_ord already defined)
(label elirreg_ord already defined)
(label ellocelc already defined)
(label ellocgov already defined)
(label ellocpwr_ord already defined)
(label elmulpar_ord already defined)
(label elpaidig_ord already defined)
(label elpdcamp_ord already defined)
(label elpeace_ord already defined)
(label elpubfin_ord already defined)
(label elreggov already defined)
(label elrgpwr_ord already defined)
(label elrgstry_ord already defined)
(label elrstrct already defined)
(label elsnlsff_ord already defined)
(label elsrgel already defined)
(label eltvrexo already defined)
(label eltvrig already defined)
(label elvotbuy_ord already defined)
(label x_regime already defined)
(label exl_legitlead_ord already defined)
(label smgovfilprc_ord already defined)
(label smpolsoc_ord already defined)
(label regsupgroupssize_ord already defined)
(label smgovsmalt_ord already defined)
(label smgovshutcap_ord already defined)
(label smgovshut_ord already defined)
(label smgovsm_ord already defined)
(label smgovsmmon_ord already defined)
(label smgovsmcenprc_ord already defined)
(label v2cacamps_ord_labels already defined)
(label v2regimpgroup_label already defined)

.                         tab _merge if  year<=2017 & (gwf_regime=="democracy" | gw
> f_regime=="provisional")

     _merge |      Freq.     Percent        Cum.
------------+-----------------------------------
          2 |         53        2.29        2.29
          3 |      2,261       97.71      100.00
------------+-----------------------------------
      Total |      2,314      100.00

.                         tab gwf_country if _merge==2 &  year<=2017 & (gwf_regime=
> ="democracy" | gwf_regime=="provisional")

               Country |      Freq.     Percent        Cum.
-----------------------+-----------------------------------
           Afghanistan |          3        5.66        5.66
       Cen African Rep |         10       18.87       24.53
             Congo-Brz |          6       11.32       35.85
        Czechoslovakia |          4        7.55       43.40
         Guinea Bissau |         15       28.30       71.70
                Kosovo |          9       16.98       88.68
            Mauritania |          1        1.89       90.57
               Somalia |          5        9.43      100.00
-----------------------+-----------------------------------
                 Total |         53      100.00

.                         drop if _merge==1
(546 observations deleted)

.                         rename _merge merge7

.                         sort cowcode year

.                         save master,replace
file master.dta saved

.                 
.                         use "esvp-johnson-wallack-2012.dta",clear

.                         gen cowcode = .
(4,804 missing values generated)

.                         qui do cowcodes

.                         tab country if cowcode==.

                                country |      Freq.     Percent        Cum.
----------------------------------------+-----------------------------------
                    Congo (Republic of) |         28       13.46       13.46
           Congo, Democratic Repulic of |         28       13.46       26.92
          Germany (Federal Republic of) |         12        5.77       32.69
Korea (Democratic People's Republic o.. |         28       13.46       46.15
       Korea (South, Republic of Korea) |         28       13.46       59.62
Macedonia, The Former Yugoslavian Rep.. |         28       13.46       73.08
       Saint Vincent and the Grenadines |         28       13.46       86.54
             Taiwan (Republic of China) |         28       13.46      100.00
----------------------------------------+-----------------------------------
                                  Total |        208      100.00

.                         replace cowcode = 484 if country=="Congo (Republic of)"
(28 real changes made)

.                         replace cowcode = 490 if country=="Congo, Democratic Repu
> lic of"
(28 real changes made)

.                         replace cowcode = 255 if country=="Germany (Federal Repub
> lic of)"
(12 real changes made)

.                         replace cowcode = 732  if country=="Korea (South, Republi
> c of Korea)"
(28 real changes made)

.                         replace cowcode = 713 if country=="Taiwan (Republic of Ch
> ina)"
(28 real changes made)

.                         replace cowcode = 731 if shcode==205
(28 real changes made)

.                         replace cowcode = 343 if shcode==240
(28 real changes made)

.                         tab country if cowcode==.

                                country |      Freq.     Percent        Cum.
----------------------------------------+-----------------------------------
       Saint Vincent and the Grenadines |         28      100.00      100.00
----------------------------------------+-----------------------------------
                                  Total |         28      100.00

.                         drop if cowcode==.
(28 observations deleted)

.                         sort cowcode year

.                         merge cowcode year using master
(you are using old merge syntax; see [D] merge for new syntax)
(variable year was int, now double to accommodate using data's values)
(variable cowcode was float, now double to accommodate using data's values)

.                         tab _merge

     _merge |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |      2,329       32.57       32.57
          2 |      2,375       33.21       65.78
          3 |      2,447       34.22      100.00
------------+-----------------------------------
      Total |      7,151      100.00

.                         rename _merge merge10

.                         xtset cowcode year

Panel variable: cowcode (unbalanced)
 Time variable: year, 1978 to 2020
         Delta: 1 unit

.                         sort cowcode year

.                         save master,replace
file master.dta saved

.                         
. 
. ***************************************************
. ************* A: Personalist Party data ***********
. ***************************************************
. 
.         *****************************
.         *** Import and clean data ***
.         *****************************
.         import excel using "$dir\Personalist-Parties-Final",clear firstrow  
(110 vars, 2,516 obs)

.         drop  *_s electing_p_prior_elect_national_

.         sum year

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
        year |      2,516    2006.481    8.532853       1989       2020

.         
.         * List and drop technocratic appointments *
.                 egen tag=tag(current_leader) if electing_p_name=="Technocrat appo
> intment"

.                 list country current_leader if tag==1

      +--------------------------------------------+
      |        country              current_leader |
      |--------------------------------------------|
  62. |          Haiti      Ertha Pascal-Trouillot |
 949. | Czech Republic              Josef Tosovsky |
 961. | Czech Republic                 Jan Fischer |
1003. |          Italy        Carlo Azeglio Ciampi |
1004. |          Italy                Lamberto Din |
      |--------------------------------------------|
1021. |          Italy                 Mario Monti |
1201. |         Greece   Lucas Demetrios Papademos |
1279. |        Romania             Mugur Isarescu  |
2298. |     Bangladesh           Shahabuddin Ahmed |
2314. |     Bangladesh            Fakhruddin Ahmed |
      |--------------------------------------------|
2376. |          Nepal              Khil Raj Regmi |
      +--------------------------------------------+

.                 drop if electing_p_name=="Technocrat appointment"
(14 observations deleted)

.                 drop tag

.                 
.                 tab current_p_create,m

current_p_c |
      reate |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      1,697       67.83       67.83
          1 |        238        9.51       77.34
          2 |         80        3.20       80.54
          3 |        450       17.99       98.52
          9 |         37        1.48      100.00
------------+-----------------------------------
      Total |      2,502      100.00

.                 tab electing_p_create,m

electing_p_ |
     create |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      1,705       68.15       68.15
          1 |        266       10.63       78.78
          2 |         76        3.04       81.81
          3 |        407       16.27       98.08
          9 |         48        1.92      100.00
------------+-----------------------------------
      Total |      2,502      100.00

.                 tab current_p_name if current_p_create==9  /* These are the true 
> independents who never form a party while in office */

                         current_p_name |      Freq.     Percent        Cum.
----------------------------------------+-----------------------------------
                                    N/A |         37      100.00      100.00
----------------------------------------+-----------------------------------
                                  Total |         37      100.00

.                 tab current_p_create if current_p_name=="Technocrat appointment" 
>  /* These are technocrats who don't have parties */
no observations

.                 tab electing_p_name if electing_p_create==9 

                        electing_p_name |      Freq.     Percent        Cum.
----------------------------------------+-----------------------------------
                                    N/A |         48      100.00      100.00
----------------------------------------+-----------------------------------
                                  Total |         48      100.00

.                 tab electing_p_create if electing_p_name=="Technocrat appointment
> "  /* These are technocrats who don't have parties */
no observations

.                 tab electing_p_create if electing_p_name=="N/A"

electing_p_ |
     create |      Freq.     Percent        Cum.
------------+-----------------------------------
          9 |         48      100.00      100.00
------------+-----------------------------------
      Total |         48      100.00

.                 list current_p_name country year current_leader if electing_p_nam
> e=="N/A", noobs clean

                                current_p_name         country   year     current_l
> eader  
                                           N/A        Bulgaria   1991      Dimitar 
> Popov  
                                           N/A          Latvia   1996        Andre 
> Škéle  
                                           N/A          Latvia   1997        Andre 
> Škéle  
                                           N/A       Lithuania   2020    Gitanas Na
> useda  
                                           N/A   Guinea Bissau   2006         Joao 
> Viera  
                                           N/A   Guinea Bissau   2007         Joao 
> Viera  
                                           N/A   Guinea Bissau   2008         Joao 
> Viera  
                                           N/A   Guinea Bissau   2009         Joao 
> Viera  
    Cowrie Forces for an Emerging Benin (FCBE)           Benin   2007   Thomas Boni
>  Yayi  
    Cowrie Forces for an Emerging Benin (FCBE)           Benin   2008   Thomas Boni
>  Yayi  
    Cowrie Forces for an Emerging Benin (FCBE)           Benin   2009   Thomas Boni
>  Yayi  
    Cowrie Forces for an Emerging Benin (FCBE)           Benin   2010   Thomas Boni
>  Yayi  
    Cowrie Forces for an Emerging Benin (FCBE)           Benin   2011   Thomas Boni
>  Yayi  
    Cowrie Forces for an Emerging Benin (FCBE)           Benin   2012   Thomas Boni
>  Yayi  
    Cowrie Forces for an Emerging Benin (FCBE)           Benin   2013   Thomas Boni
>  Yayi  
    Cowrie Forces for an Emerging Benin (FCBE)           Benin   2014   Thomas Boni
>  Yayi  
    Cowrie Forces for an Emerging Benin (FCBE)           Benin   2015   Thomas Boni
>  Yayi  
    Cowrie Forces for an Emerging Benin (FCBE)           Benin   2016   Thomas Boni
>  Yayi  
                                           N/A           Benin   2017      Patrice 
> Talon  
                                           N/A           Benin   2018      Patrice 
> Talon  
                                           N/A           Benin   2019      Patrice 
> Talon  
                             Progressive Union           Benin   2020      Patrice 
> Talon  
                                           N/A            Iraq   2019   Adel Abdul-
> Mahdi  
                                           N/A            Iraq   2020   Adel Abdul-
> Mahdi  
                                           N/A         Lebanon   1999       Émile L
> ahoud  
                                           N/A         Lebanon   2000       Émile L
> ahoud  
                                           N/A         Lebanon   2001       Émile L
> ahoud  
                                           N/A         Lebanon   2002       Émile L
> ahoud  
                                           N/A         Lebanon   2003       Émile L
> ahoud  
                                           N/A         Lebanon   2004       Émile L
> ahoud  
                                           N/A         Lebanon   2005       Émile L
> ahoud  
                                           N/A         Lebanon   2006       Émile L
> ahoud  
                                           N/A         Lebanon   2007       Émile L
> ahoud  
                                           N/A         Lebanon   2009    Michel Sul
> eiman  
                                           N/A         Lebanon   2010    Michel Sul
> eiman  
                                           N/A         Lebanon   2011    Michel Sul
> eiman  
                                           N/A         Lebanon   2012    Michel Sul
> eiman  
                                           N/A         Lebanon   2013    Michel Sul
> eiman  
                                           N/A         Lebanon   2014    Michel Sul
> eiman  
                                           N/A         Lebanon   2015       Tammam 
> Salam  
                                           N/A         Lebanon   2016       Tammam 
> Salam  
                                           N/A         Lebanon   2020        Hassan
>  Diab  
                                           N/A     Afghanistan   2015       Ashraf 
> Ghani  
                                           N/A     Afghanistan   2016       Ashraf 
> Ghani  
                                           N/A     Afghanistan   2017       Ashraf 
> Ghani  
                                           N/A     Afghanistan   2018       Ashraf 
> Ghani  
                                           N/A     Afghanistan   2019       Ashraf 
> Ghani  
                                           N/A     Afghanistan   2020       Ashraf 
> Ghani  

.                 
.                 tab electing_p_name if electing_p_merge==9

                        electing_p_name |      Freq.     Percent        Cum.
----------------------------------------+-----------------------------------
   Agrarian Democratic Party of Moldova |         11        6.79        6.79
      Alliance for the Future of Kosovo |          3        1.85        8.64
Christian-Democratic National Peasant.. |          3        1.85       10.49
            Democratic League of Kosovo |          3        1.85       12.35
    Democratic National Salvation Front |          4        2.47       14.81
                       Democratic Party |         14        8.64       23.46
             Democratic Party of Kosovo |          7        4.32       27.78
            Democratic Party of Moldova |          4        2.47       30.25
             Democratic Party of Serbia |          5        3.09       33.33
Democratic Party of Socialists of Mon.. |          3        1.85       35.19
Internal Macedonian Revolutionary Org.. |         16        9.88       45.06
    Liberal Democratic Party of Moldova |          6        3.70       48.77
                                    N/A |         45       27.78       76.54
                 National Liberal Party |          6        3.70       80.25
               National Salvation Front |          2        1.23       81.48
Party of Communists of the Republic o.. |          8        4.94       86.42
Party of Socialists of the Republic o.. |          1        0.62       87.04
              Serbian Progressive Party |          6        3.70       90.74
   Social Democratic Union of Macedonia |         13        8.02       98.77
              Socialist Party of Serbia |          2        1.23      100.00
----------------------------------------+-----------------------------------
                                  Total |        162      100.00

.                 tab electing_p_merge_month if electing_p_merge==9

electing_p_ |
merge_month |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |        162      100.00      100.00
------------+-----------------------------------
      Total |        162      100.00

.                 tab electing_p_merge_year if electing_p_merge==9

electing_p_ |
 merge_year |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |        162      100.00      100.00
------------+-----------------------------------
      Total |        162      100.00

.                 tab electing_p_founding_month if electing_p_merge==9

electing_p_ |
founding_mo |
        nth |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |         82       50.62       50.62
          1 |          6        3.70       54.32
          2 |          4        2.47       56.79
          4 |         17       10.49       67.28
          5 |         13        8.02       75.31
          6 |         15        9.26       84.57
          9 |          6        3.70       88.27
         10 |          7        4.32       92.59
         12 |         11        6.79       99.38
         99 |          1        0.62      100.00
------------+-----------------------------------
      Total |        162      100.00

.                 tab electing_p_founding_year if electing_p_merge==9

electing_p_ |
founding_ye |
         ar |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |         45       27.78       27.78
       1989 |          9        5.56       33.33
       1990 |         39       24.07       57.41
       1991 |         15        9.26       66.67
       1992 |          9        5.56       72.22
       1993 |         10        6.17       78.40
       1994 |          8        4.94       83.33
       1997 |          5        3.09       86.42
       1999 |          7        4.32       90.74
       2000 |          3        1.85       92.59
       2007 |          6        3.70       96.30
       2008 |          6        3.70      100.00
------------+-----------------------------------
      Total |        162      100.00

.                 
.         ******************
.         *** Clean data ***
.         ******************
.                 recode current_p_create electing_p_create (9=3)  /* no party==sol
> e party creation */
(37 changes made to current_p_create)
(48 changes made to electing_p_create)

.                 recode current_p_create current_p_leader_family current_p_creator
> _family ///
>                 current_p_prior_elect_local current_p_prior_appt_local current_p_
> prior_elect_nati ///
>                 current_p_prior_appt_na current_p_prior_national_p electing_p_cre
> ate ///
>                 electing_p_leader_family electing_p_creator_family electing_p_pri
> or_elect_loc ///
>                 electing_p_prior_appt_l electing_p_prior_elect_nat electing_p_pri
> or_appt_n ///
>                 electing_p_prior_national_p prior_p_1_create prior_p_1_leader_fam
> ily ///
>                 prior_p_1_creator_family prior_p_1_prior_elect_loca prior_p_1_pri
> or_appt_lo ///
>                 prior_p_1_prior_elect_nati prior_p_1_prior_appt_na prior_p_1_prio
> r_national_p ///
>                 prior_p_2_leader_family prior_p_2_create prior_p_2_creator_family
>  prior_p_2_prior_elect_loca ///
>                 prior_p_2_prior_appt_lo prior_p_2_prior_elect_nati prior_p_2_prio
> r_appt_na ///
>                 prior_p_2_prior_national_p (9=.)
(0 changes made to current_p_create)
(37 changes made to current_p_leader_family)
(37 changes made to current_p_creator_family)
(37 changes made to current_p_prior_elect_local)
(37 changes made to current_p_prior_appt_local)
(37 changes made to current_p_prior_elect_national)
(37 changes made to current_p_prior_appt_national)
(37 changes made to current_p_prior_national_p)
(0 changes made to electing_p_create)
(48 changes made to electing_p_leader_family)
(48 changes made to electing_p_creator_family)
(48 changes made to electing_p_prior_elect_local)
(48 changes made to electing_p_prior_appt_local)
(48 changes made to electing_p_prior_elect_national)
(48 changes made to electing_p_prior_appt_national)
(48 changes made to electing_p_prior_national_p)
(1,621 changes made to prior_p_1_create)
(1,633 changes made to prior_p_1_leader_family)
(1,633 changes made to prior_p_1_creator_family)
(1,622 changes made to prior_p_1_prior_elect_local)
(1,626 changes made to prior_p_1_prior_appt_local)
(1,622 changes made to prior_p_1_prior_elect_national)
(1,622 changes made to prior_p_1_prior_appt_national)
(1,622 changes made to prior_p_1_prior_national_p)
(2,235 changes made to prior_p_2_leader_family)
(2,168 changes made to prior_p_2_create)
(2,235 changes made to prior_p_2_creator_family)
(2,235 changes made to prior_p_2_prior_elect_local)
(2,235 changes made to prior_p_2_prior_appt_local)
(2,235 changes made to prior_p_2_prior_elect_national)
(2,234 changes made to prior_p_2_prior_appt_national)
(2,223 changes made to prior_p_2_prior_national_p)

.          
.         ******************************
.         *** Variable construction  ***
.         ******************************   
.                 * Recode missing to zero *
.                 recode prior_p_1_prior_elect_loca prior_p_1_create prior_p_1_lead
> er_family ///
>                         prior_p_1_creator_family  ///
>                         prior_p_1_prior_appt_lo prior_p_1_prior_elect_nati ///
>                         prior_p_1_prior_appt_na prior_p_1_prior_national_p (.=0)
(1,622 changes made to prior_p_1_prior_elect_local)
(1,621 changes made to prior_p_1_create)
(1,634 changes made to prior_p_1_leader_family)
(1,635 changes made to prior_p_1_creator_family)
(1,626 changes made to prior_p_1_prior_appt_local)
(1,622 changes made to prior_p_1_prior_elect_national)
(1,622 changes made to prior_p_1_prior_appt_national)
(1,622 changes made to prior_p_1_prior_national_p)

.                 recode electing_p_prior_elect_loc electing_p_prior_appt_l ///
>                         electing_p_prior_elect_nat electing_p_prior_appt_n ///
>                         electing_p_prior_national_p (.=0)
(48 changes made to electing_p_prior_elect_local)
(48 changes made to electing_p_prior_appt_local)
(48 changes made to electing_p_prior_elect_national)
(48 changes made to electing_p_prior_appt_national)
(48 changes made to electing_p_prior_national_p)

.                 recode electing_p_leader_family electing_p_creator_family (.=0)
(48 changes made to electing_p_leader_family)
(48 changes made to electing_p_creator_family)

.                 
.                 * Short names *
.                 gen localelect = electing_p_prior_elect_l

.                 gen localappt = electing_p_prior_appt_l 

.                 gen natelect = electing_p_prior_elect_n

.                 gen natappt = electing_p_prior_appt_n

.                 gen natparty = electing_p_prior_national_p

.                             
.                 * Binary party creation variable, not merger *
.                 gen create = electing_p_create==1 | electing_p_create==3 | electi
> ng_p_name=="N/A"  

.   
.                 * Prior independent grouped together *
.                 recode indep* (9=0)
(60 changes made to indep_prior_local_elect)
(60 changes made to indep_prior_local_appt)
(60 changes made to indep_prior_national_elect)
(60 changes made to indep_prior_national_appt)
(60 changes made to indep_prior_national_defeated)

.                 sum indep*

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
in~cal_elect |      2,502    .0143885    .1191097          0          1
ind~cal_appt |      2,502    .0079936    .0890667          0          1
in~nal_elect |      2,502    .0215827    .1453457          0          1
ind~nal_appt |      2,502    .0895284     .285562          0          1
indep_prio~d |      2,502    .0395683    .1949818          0          1

.                 gen priorindep = indep_prior_local_elect==1 |  indep_prior_local_
> appt==1 | ///
>                         indep_prior_national_elect==1 | indep_prior_national_appt
> ==1 | ///
>                         indep_prior_national_defea==1           

.                 
.                 * Leaders *
.                 egen lid = group(leader_id)

.                 egen minyr = min(year),by(lid)

. 
.                 * Party age *
.                 gen partyage = current_leader_start_year-electing_p_founding_year
>  if electing_p_founding_year>0
(48 missing values generated)

.                 browse country year current_leader current_p_name current_p_creat
> e if electing_p_founding_year==0

.                 recode partyage (.=0) 
(48 changes made to partyage)

.                 replace partyage=0 if partyage<0
(17 real changes made)

.                 gen lnpartyage =ln(1+partyage)

.  
.                 * Experience in the party *
.                 replace first_year_exp="." if first_year_exp=="N/A"
(47 real changes made)

.                 replace year_date_position="." if year_date_position=="N/A"
(48 real changes made)

.                 destring year_date_position first_year_exp,replace
year_date_position: all characters numeric; replaced as int
(48 missing values generated)
first_year_exp: all characters numeric; replaced as int
(48 missing values generated)

.                 sum year year_date_position first_year_exp

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
        year |      2,502    2006.501    8.529402       1989       2020
year_date_~n |      2,454    1990.914    13.24334       1944       2019
first_year~p |      2,454    1987.259    14.72469       1941       2019

.                 gen timeparty = current_leader_start_year-first_year_exp
(48 missing values generated)

.                 replace timeparty =0 if timeparty==. | timeparty<0
(75 real changes made)

.                 qui centile partyage if create==0,centile(50) /* old parties */

.                 local cut1 = r(c_1)

.                 qui centile timeparty if create==0,centile(33.33)  /* not super n
> ew party experience */

.                 local cut2 = r(c_1)

.                 gen partyexp = partyage>`cut1' & timeparty>=10

.                 tab partyexp create

           |        create
  partyexp |         0          1 |     Total
-----------+----------------------+----------
         0 |     1,054        721 |     1,775 
         1 |       727          0 |       727 
-----------+----------------------+----------
     Total |     1,781        721 |     2,502 

.                 
.                 * Flip scale so 1 \equiv more personalist *
.                 recode localappt natelect natappt natparty localelect partyexp (1
> =0) (0=1)
(2,502 changes made to localappt)
(2,502 changes made to natelect)
(2,502 changes made to natappt)
(2,502 changes made to natparty)
(2,502 changes made to localelect)
(2,502 changes made to partyexp)

.                 
.                 * Set sample *
.                 gen cowcode = ccode

.                 drop if cowcode==.
(0 observations deleted)

.                 sort cowcode year

.                 xtset cowcode year

Panel variable: cowcode (unbalanced)
 Time variable: year, 1989 to 2020, but with gaps
         Delta: 1 unit

.          
.                 * Show that family variables lie along a distinct dimension: 
.                 * should not be modeled with SEM-IRT, which assumes one dimension
> , which is create party *
.                 factor electing_p_creator_family electing_p_leader_family ///
>                         natelect natappt natparty localappt create localelect pri
> orindep partyexp,mineigen(1)
(obs=2,502)

Factor analysis/correlation                      Number of obs    =      2,502
    Method: principal factors                    Retained factors =          2
    Rotation: (unrotated)                        Number of params =         19

    --------------------------------------------------------------------------
         Factor  |   Eigenvalue   Difference        Proportion   Cumulative
    -------------+------------------------------------------------------------
        Factor1  |      1.53547      0.34774            0.6196       0.6196
        Factor2  |      1.18774      0.79333            0.4793       1.0988
        Factor3  |      0.39441      0.23077            0.1591       1.2580
        Factor4  |      0.16364      0.12233            0.0660       1.3240
        Factor5  |      0.04131      0.01723            0.0167       1.3407
        Factor6  |      0.02408      0.15931            0.0097       1.3504
        Factor7  |     -0.13523      0.08824           -0.0546       1.2958
        Factor8  |     -0.22347      0.00569           -0.0902       1.2057
        Factor9  |     -0.22916      0.05138           -0.0925       1.1132
       Factor10  |     -0.28054            .           -0.1132       1.0000
    --------------------------------------------------------------------------
    LR test: independent vs. saturated:  chi2(45) = 4096.37 Prob>chi2 = 0.0000

Factor loadings (pattern matrix) and unique variances

    -------------------------------------------------
        Variable |  Factor1   Factor2 |   Uniqueness 
    -------------+--------------------+--------------
    el~or_family |  -0.3928    0.6717 |      0.3945  
    el~er_family |  -0.4603    0.6447 |      0.3725  
        natelect |   0.4679    0.1985 |      0.7417  
         natappt |   0.4053    0.3386 |      0.7211  
        natparty |   0.3532    0.1007 |      0.8651  
       localappt |   0.2153    0.1849 |      0.9195  
          create |   0.4779    0.1680 |      0.7434  
      localelect |   0.1664    0.1737 |      0.9421  
      priorindep |   0.2808    0.0535 |      0.9183  
        partyexp |   0.5293    0.2474 |      0.6587  
    -------------------------------------------------

.                 rotate, oblique promax(3)

Factor analysis/correlation                      Number of obs    =      2,502
    Method: principal factors                    Retained factors =          2
    Rotation: oblique promax (Kaiser off)        Number of params =         19

    --------------------------------------------------------------------------
         Factor  |     Variance   Proportion    Rotated factors are correlated
    -------------+------------------------------------------------------------
        Factor1  |      1.46503       0.5912
        Factor2  |      1.29059       0.5208
    --------------------------------------------------------------------------
    LR test: independent vs. saturated:  chi2(45) = 4096.37 Prob>chi2 = 0.0000

Rotated factor loadings (pattern matrix) and unique variances

    -------------------------------------------------
        Variable |  Factor1   Factor2 |   Uniqueness 
    -------------+--------------------+--------------
    el~or_family |   0.0359    0.7812 |      0.3945  
    el~er_family |  -0.0358    0.7875 |      0.3725  
        natelect |   0.5035   -0.0335 |      0.7417  
         natappt |   0.5273    0.1206 |      0.7211  
        natparty |   0.3533   -0.0694 |      0.8651  
       localappt |   0.2829    0.0687 |      0.9195  
          create |   0.4953   -0.0655 |      0.7434  
      localelect |   0.2355    0.0807 |      0.9421  
      priorindep |   0.2663   -0.0791 |      0.9183  
        partyexp |   0.5821   -0.0174 |      0.6587  
    -------------------------------------------------

Factor rotation matrix

    --------------------------------
                 | Factor1  Factor2 
    -------------+------------------
         Factor1 |  0.8930  -0.5439 
         Factor2 |  0.4501   0.8392 
    --------------------------------

.                 screeplot,tit(Eigen values for 8 items plus 2 family items)saving
> (h1.gph,replace)
file h1.gph saved

.                 loadingplot,saving(h2.gph,replace) note("")
file h2.gph saved

.                 gr combine h1.gph h2.gph,xsize(8)

.  
.                 * Variables for 8-item IRT *
.                 factortest natelect natappt natparty localappt create localelect 
> priorindep partyexp
    
Determinant of the correlation matrix
Det                =     0.428
 
 
Bartlett test of sphericity
    
Chi-square         =          2120.546
Degrees of freedom =                28
p-value            =             0.000
H0: variables are not intercorrelated
 
 
Kaiser-Meyer-Olkin Measure of Sampling Adequacy
KMO               =     0.670
 

.                 factor     natelect natappt natparty localappt create localelect 
> priorindep partyexp,mineigen(.25)  
(obs=2,502)

Factor analysis/correlation                      Number of obs    =      2,502
    Method: principal factors                    Retained factors =          2
    Rotation: (unrotated)                        Number of params =         15

    --------------------------------------------------------------------------
         Factor  |   Eigenvalue   Difference        Proportion   Cumulative
    -------------+------------------------------------------------------------
        Factor1  |      1.43524      1.04554            1.0599       1.0599
        Factor2  |      0.38969      0.24538            0.2878       1.3477
        Factor3  |      0.14432      0.10536            0.1066       1.4543
        Factor4  |      0.03896      0.02420            0.0288       1.4830
        Factor5  |      0.01476      0.17316            0.0109       1.4939
        Factor6  |     -0.15840      0.07392           -0.1170       1.3769
        Factor7  |     -0.23232      0.04580           -0.1716       1.2054
        Factor8  |     -0.27812            .           -0.2054       1.0000
    --------------------------------------------------------------------------
    LR test: independent vs. saturated:  chi2(28) = 2121.39 Prob>chi2 = 0.0000

Factor loadings (pattern matrix) and unique variances

    -------------------------------------------------
        Variable |  Factor1   Factor2 |   Uniqueness 
    -------------+--------------------+--------------
        natelect |   0.5096    0.2707 |      0.6670  
         natappt |   0.5104   -0.0374 |      0.7381  
        natparty |   0.3655    0.3924 |      0.7125  
       localappt |   0.2747   -0.1670 |      0.8967  
          create |   0.4942   -0.2860 |      0.6740  
      localelect |   0.2249   -0.1192 |      0.9352  
      priorindep |   0.2766    0.1277 |      0.9072  
        partyexp |   0.5785   -0.1445 |      0.6444  
    -------------------------------------------------

.                 screeplot,tit(Eigen values for 8 items)saving(h1.gph,replace)xlab
> (0(2)8)
file h1.gph saved

.                 loadingplot,saving(h2.gph,replace)
file h2.gph saved

.                 gr combine h1.gph h2.gph,xsize(8)

.                 erase h1.gph

.                 erase h2.gph

. 
.                 * IRT *
.                 sum create natelect natappt natparty localelect localappt priorin
> d partyexp

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
      create |      2,502    .2881695    .4530009          0          1
    natelect |      2,502    .3641087    .4812755          0          1
     natappt |      2,502    .5443645    .4981275          0          1
    natparty |      2,502    .2617906    .4396971          0          1
  localelect |      2,502    .8077538    .3941443          0          1
-------------+---------------------------------------------------------
   localappt |      2,502    .9548361    .2077049          0          1
  priorindep |      2,502     .117506    .3220866          0          1
    partyexp |      2,502    .7094325     .454115          0          1

.                 polychoric create natelect natappt natparty localelect localappt 
> priorind partyexp
numerical derivatives are approximate
nearby values are missing
could not calculate numerical derivatives
missing values encountered
could not calculate numerical derivatives
missing values encountered
numerical derivatives are approximate
nearby values are missing
numerical derivatives are approximate
nearby values are missing
numerical derivatives are approximate
nearby values are missing
could not calculate numerical derivatives
missing values encountered
numerical derivatives are approximate
nearby values are missing
numerical derivatives are approximate
nearby values are missing
numerical derivatives are approximate
nearby values are missing

Polychoric correlation matrix

                create    natelect     natappt    natparty  localelect   localappt
    create           1
  natelect    .2638436           1
   natappt   .53447885   .45699486           1
  natparty   .07891279   .59784358   .29014443           1
localelect   .36613849   .23026513  -.03013549   .11564279           1
 localappt           .   .26184635   .55797834   .04748357     .408485           1
priorindep   .13806408   .23717864    .2292996   .39056725   .12304342   .94587388
  partyexp   .98941579   .48233451   .47521331   .25564974   .26470419   .42567574

            priorindep    partyexp
priorindep           1
  partyexp   .58636676           1

.                 tab localappt create

           |        create
 localappt |         0          1 |     Total
-----------+----------------------+----------
         0 |       113          0 |       113 
         1 |     1,668        721 |     2,389 
-----------+----------------------+----------
     Total |     1,781        721 |     2,502 

.                 tab partyexp create

           |        create
  partyexp |         0          1 |     Total
-----------+----------------------+----------
         0 |       727          0 |       727 
         1 |     1,054        721 |     1,775 
-----------+----------------------+----------
     Total |     1,781        721 |     2,502 

.                 tab localappt priorind

           |      priorindep
 localappt |         0          1 |     Total
-----------+----------------------+----------
         0 |       113          0 |       113 
         1 |     2,095        294 |     2,389 
-----------+----------------------+----------
     Total |     2,208        294 |     2,502 

.                 corr create natelect natappt natparty localelect localappt priori
> nd partyexp
(obs=2,502)

             |   create natelect  natappt natparty locale~t locala~t priori~p
-------------+---------------------------------------------------------------
      create |   1.0000
    natelect |   0.1604   1.0000
     natappt |   0.3252   0.2903   1.0000
    natparty |   0.0447   0.3864   0.1706   1.0000
  localelect |   0.1738   0.1204  -0.0166   0.0575   1.0000
   localappt |   0.1384   0.0846   0.1913   0.0157   0.1674   1.0000
  priorindep |   0.0665   0.1185   0.1095   0.2034   0.0489   0.0794   1.0000
    partyexp |   0.4072   0.2757   0.2983   0.1368   0.1480   0.1703   0.2062

             | partyexp
-------------+---------
    partyexp |   1.0000


.                 alpha  create natelect natappt natparty localelect localappt prio
> rind partyexp,item detail std

Test scale = mean(standardized items)

                                                            Average
                             Item-test     Item-rest       interitem
Item         |  Obs  Sign   correlation   correlation     correlation     alpha
-------------+-----------------------------------------------------------------
create       | 2502    +       0.5592        0.3579          0.1554      0.5629
natelect     | 2502    +       0.5882        0.3941          0.1496      0.5519
natappt      | 2502    +       0.5718        0.3736          0.1529      0.5581
natparty     | 2502    +       0.4865        0.2700          0.1697      0.5886
localelect   | 2502    +       0.4103        0.1820          0.1847      0.6133
localappt    | 2502    +       0.4459        0.2227          0.1777      0.6020
priorindep   | 2502    +       0.4424        0.2187          0.1784      0.6032
partyexp     | 2502    +       0.6379        0.4578          0.1398      0.5322
-------------+-----------------------------------------------------------------
Test scale   |                                               0.1635      0.6100
-------------------------------------------------------------------------------

Interitem correlations (obs=2502 in all pairs)

                create    natelect     natappt    natparty  localelect   localappt
    create      1.0000
  natelect      0.1604      1.0000
   natappt      0.3252      0.2903      1.0000
  natparty      0.0447      0.3864      0.1706      1.0000
localelect      0.1738      0.1204     -0.0166      0.0575      1.0000
 localappt      0.1384      0.0846      0.1913      0.0157      0.1674      1.0000
priorindep      0.0665      0.1185      0.1095      0.2034      0.0489      0.0794
  partyexp      0.4072      0.2757      0.2983      0.1368      0.1480      0.1703

            priorindep    partyexp
priorindep      1.0000
  partyexp      0.2062      1.0000

. 
.                  /* local elect contributes the least info */
.                 irt (2pl create natelect natappt natparty localelect localappt pr
> iorind  partyexp),vce(cluster lid) 

Fitting fixed-effects model:

Iteration 0:  Log likelihood = -10472.935  
Iteration 1:  Log likelihood = -10406.324  
Iteration 2:  Log likelihood = -10404.443  
Iteration 3:  Log likelihood = -10404.436  
Iteration 4:  Log likelihood = -10404.436  

Fitting full model:

Iteration 0:  Log pseudolikelihood = -10119.582  (not concave)
Iteration 1:  Log pseudolikelihood = -9825.1921  
Iteration 2:  Log pseudolikelihood = -9628.5957  
Iteration 3:  Log pseudolikelihood = -9616.2891  
Iteration 4:  Log pseudolikelihood = -9613.9615  
Iteration 5:  Log pseudolikelihood = -9613.7678  
Iteration 6:  Log pseudolikelihood = -9613.7616  
Iteration 7:  Log pseudolikelihood = -9613.7612  

Two-parameter logistic model                             Number of obs = 2,502
Log pseudolikelihood = -9613.7612
                                  (Std. err. adjusted for 602 clusters in lid)
------------------------------------------------------------------------------
             |               Robust
             | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
-------------+----------------------------------------------------------------
create       |
     Discrim |   1.960608   .5441586     3.60   0.000     .8940767    3.027139
        Diff |   .7452773   .1310097     5.69   0.000      .488503    1.002052
-------------+----------------------------------------------------------------
natelect     |
     Discrim |   1.157953   .2994145     3.87   0.000      .571111    1.744794
        Diff |   .6094072   .1605266     3.80   0.000     .2947807    .9240336
-------------+----------------------------------------------------------------
natappt      |
     Discrim |   1.290611   .2417504     5.34   0.000     .8167892    1.764433
        Diff |  -.1845056   .1067018    -1.73   0.084    -.3936373    .0246261
-------------+----------------------------------------------------------------
natparty     |
     Discrim |   .7345013   .2572417     2.86   0.004     .2303168    1.238686
        Diff |   1.572215   .4961842     3.17   0.002     .5997116    2.544718
-------------+----------------------------------------------------------------
localelect   |
     Discrim |   .5900576   .1582825     3.73   0.000     .2798296    .9002856
        Diff |  -2.605081   .6692338    -3.89   0.000    -3.916755   -1.293407
-------------+----------------------------------------------------------------
localappt    |
     Discrim |   1.521985     .37517     4.06   0.000     .7866652    2.257304
        Diff |  -2.615798   .4502804    -5.81   0.000    -3.498332   -1.733265
-------------+----------------------------------------------------------------
priorindep   |
     Discrim |   .9170527   .2340518     3.92   0.000     .4583196    1.375786
        Diff |   2.524019   .5237845     4.82   0.000     1.497421    3.550618
-------------+----------------------------------------------------------------
partyexp     |
     Discrim |   3.745654   1.281117     2.92   0.003      1.23471    6.256598
        Diff |  -.6197942   .0951275    -6.52   0.000    -.8062407   -.4333478
------------------------------------------------------------------------------

.                 irtgraph iif (create,lcol(red)) (partyexp,lcol(cyan)lpat(solid)) 
>  ///
>                         (natelect,lcol(blue*.5)lpat(solid)) (natappt,lcol(blue*1.
> 5)lpat(dash)) ///
>                         (priorind,lcol(magenta)lpat(solid)) (natparty,lcol(orange
> )lpat(solid))  ///
>                         (localappt,lcol(green*0.5)lpat(solid)) (localelect,lcol(g
> reen*1.5)lpat(dash)) 

.                         
.                         *** IRT info plots ***
.                         gen a1 = "&"

.                         gen a2 = "&"

.                         gen a3 = "&"

.                         gen a4 = "&"

.                         gen a5 = "&"

.                         gen a6 = "&"

.                         gen b = "\\"

.                         gen discr=.
(2,502 missing values generated)

.                         gen diff=.
(2,502 missing values generated)

.                         gen hi_disc = .
(2,502 missing values generated)

.                         gen lo_disc = .
(2,502 missing values generated)

.                         gen hi_diff = .
(2,502 missing values generated)

.                         gen lo_diff = .
(2,502 missing values generated)

.                         gen xn = _n

.                         gen var = ""
(2,502 missing values generated)

.                         irt (2pl create natelect natappt natparty localelect loca
> lappt priorind partyexp),vce(cluster lid) 

Fitting fixed-effects model:

Iteration 0:  Log likelihood = -10472.935  
Iteration 1:  Log likelihood = -10406.324  
Iteration 2:  Log likelihood = -10404.443  
Iteration 3:  Log likelihood = -10404.436  
Iteration 4:  Log likelihood = -10404.436  

Fitting full model:

Iteration 0:  Log pseudolikelihood = -10119.582  (not concave)
Iteration 1:  Log pseudolikelihood = -9825.1921  
Iteration 2:  Log pseudolikelihood = -9628.5957  
Iteration 3:  Log pseudolikelihood = -9616.2891  
Iteration 4:  Log pseudolikelihood = -9613.9615  
Iteration 5:  Log pseudolikelihood = -9613.7678  
Iteration 6:  Log pseudolikelihood = -9613.7616  
Iteration 7:  Log pseudolikelihood = -9613.7612  

Two-parameter logistic model                             Number of obs = 2,502
Log pseudolikelihood = -9613.7612
                                  (Std. err. adjusted for 602 clusters in lid)
------------------------------------------------------------------------------
             |               Robust
             | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
-------------+----------------------------------------------------------------
create       |
     Discrim |   1.960608   .5441586     3.60   0.000     .8940767    3.027139
        Diff |   .7452773   .1310097     5.69   0.000      .488503    1.002052
-------------+----------------------------------------------------------------
natelect     |
     Discrim |   1.157953   .2994145     3.87   0.000      .571111    1.744794
        Diff |   .6094072   .1605266     3.80   0.000     .2947807    .9240336
-------------+----------------------------------------------------------------
natappt      |
     Discrim |   1.290611   .2417504     5.34   0.000     .8167892    1.764433
        Diff |  -.1845056   .1067018    -1.73   0.084    -.3936373    .0246261
-------------+----------------------------------------------------------------
natparty     |
     Discrim |   .7345013   .2572417     2.86   0.004     .2303168    1.238686
        Diff |   1.572215   .4961842     3.17   0.002     .5997116    2.544718
-------------+----------------------------------------------------------------
localelect   |
     Discrim |   .5900576   .1582825     3.73   0.000     .2798296    .9002856
        Diff |  -2.605081   .6692338    -3.89   0.000    -3.916755   -1.293407
-------------+----------------------------------------------------------------
localappt    |
     Discrim |   1.521985     .37517     4.06   0.000     .7866652    2.257304
        Diff |  -2.615798   .4502804    -5.81   0.000    -3.498332   -1.733265
-------------+----------------------------------------------------------------
priorindep   |
     Discrim |   .9170527   .2340518     3.92   0.000     .4583196    1.375786
        Diff |   2.524019   .5237845     4.82   0.000     1.497421    3.550618
-------------+----------------------------------------------------------------
partyexp     |
     Discrim |   3.745654   1.281117     2.92   0.003      1.23471    6.256598
        Diff |  -.6197942   .0951275    -6.52   0.000    -.8062407   -.4333478
------------------------------------------------------------------------------

.                         mat e = e(b)

.                         mat var = r(V)

.                         forval i = 1(2)15 {
  2.                                 qui replace discr=e[1,`i'] if xn==`i'
  3.                                 qui local v = sqrt(var[`i',`i']) 
  4.                                 qui replace hi_disc =  e[1,`i'] + 1.96*`v' if 
> xn==`i'
  5.                                 qui replace lo_disc =  e[1,`i'] - 1.96*`v' if 
> xn==`i'
  6.                         }

.                         forval i = 2(2)16 {
  2.                                 local j = `i'-1
  3.                                 qui replace diff= -1*(e[1,`i']/e[1,`j']) if xn
> ==`i'-1
  4.                                 local v =  sqrt(var[`i',`i'])
  5.                                 qui replace hi_diff = (-1*(e[1,`i']/e[1,`j']))
>  + 1.96*`v' if xn==`i'-1
  6.                                 qui replace lo_diff = (-1*(e[1,`i']/e[1,`j']))
>  - 1.96*`v' if xn==`i'-1
  7.                         }

.                         qui replace var = "create" if xn==1

.                         qui replace var = "natelect" if xn==3

.                         qui replace var = "natappt" if xn==5

.                         qui replace var = "natparty" if xn==7

.                         qui replace var = "localelect" if xn==9

.                         qui replace var = "localappt" if xn==11

.                         qui replace var = "priorind" if xn==13

.                         qui replace var = "partyexp" if xn==15

.                         list var a1 hi_disc  discr   lo_disc a4  hi_diff   diff  
>  lo_diff  if xn<=16,clean noobs

           var   a1    hi_disc      discr    lo_disc   a4     hi_diff        diff  
>    lo_diff  
        create    &   3.027158   1.960608    .894057    &    1.002056    .7452773  
>   .4884983  
                  &          .          .          .    &           .           .  
>          .  
      natelect    &   1.744805   1.157953   .5711002    &    .9240394    .6094072  
>    .294775  
                  &          .          .          .    &           .           .  
>          .  
       natappt    &   1.764442   1.290611   .8167805    &      .02463   -.1845056  
>  -.3936411  
                  &          .          .          .    &           .           .  
>          .  
      natparty    &   1.238695   .7345012   .2303075    &    2.544736    1.572215  
>   .5996938  
                  &          .          .          .    &           .           .  
>          .  
    localelect    &   .9002913   .5900576   .2798239    &   -1.293383   -2.605081  
>   -3.91678  
                  &          .          .          .    &           .           .  
>          .  
     localappt    &   2.257318   1.521985   .7866516    &   -1.733248   -2.615798  
>  -3.498348  
                  &          .          .          .    &           .           .  
>          .  
      priorind    &   1.375794   .9170527   .4583112    &    3.550637    2.524019  
>   1.497402  
                  &          .          .          .    &           .           .  
>          .  
      partyexp    &   6.256644   3.745654   1.234664    &   -.4333444   -.6197942  
>  -.8062441  
                  &          .          .          .    &           .           .  
>          .  

.                         twoway (rspike hi_disc lo_disc xn  if xn<=16,horizontal x
> line(0) tit(Discrimination)) ///
>                                 (scatter xn disc if xn<=16,msym(P)saving(h1.gph,r
> eplace)legend(off)ytit(Item)xtit(Information) ///
>                                 ylab(1 "create party" 3 "national elected" 5 "nat
> ional appointed" 7 "party leadership" ///
>                                 9 "local elected" 11 "local appointed" 13 "prior 
> indep." 15 " party exper."))
(note:  named style P not found in class symbol, default attributes used)
(file h1.gph not found)
file h1.gph saved

.                         twoway (rspike hi_diff lo_diff xn if xn<=16,xline(0)tit(D
> ifficulty)horizontal) ///
>                                 (scatter xn diff if xn<=16,msym(P)saving(h2.gph,r
> eplace)legend(off)ytit(Item)xtit({&theta}) ///
>                                 ylab(1 "create party" 3 "national elected" 5 "nat
> ional appointed" 7 "party leadership" ///
>                                 9 "local elected" 11 "local appointed" 13 "prior 
> indep." 15 " party exper."))
(note:  named style P not found in class symbol, default attributes used)
(file h2.gph not found)
file h2.gph saved

.                         gr combine h1.gph h2.gph
(note:  named style P not found in class symbol, default attributes used)
(note:  named style P not found in class symbol, default attributes used)

.                         erase h1.gph

.                         erase h2.gph

.                         drop a1 a2 a3 a4 a5 a6 

.                 gr export "$dir\golden\Ch2A-iif.pdf",as(pdf)replace 
file
    C:\Users\jgw12\Dropbox\Research\PersPartyBook\Data\FKTW-reproduction\golden\C
    > h2A-iif.pdf saved as PDF format

.                 estat ic

Akaike's information criterion and Bayesian information criterion

-----------------------------------------------------------------------------
       Model |          N   ll(null)  ll(model)      df        AIC        BIC
-------------+---------------------------------------------------------------
           . |      2,502          .  -9613.761      16   19259.52   19352.72
-----------------------------------------------------------------------------
Note: BIC uses N = number of observations. See [R] IC note.

.                 predict persparty,latent ebmeans se(se_pers)
(using 7 quadrature points)

.                 gsem (PER->localappt localelect create natelect natappt natparty 
> priorindep,logit var(PER@1)) ///
>                         (PER->partyage timeparty,reg var(PER@1)),vce(cluster lid)

Fitting fixed-effects model:

Iteration 0:  Log likelihood =  -31713.81  
Iteration 1:  Log likelihood =  -31651.12  
Iteration 2:  Log likelihood = -31649.341  
Iteration 3:  Log likelihood = -31649.334  
Iteration 4:  Log likelihood = -31649.334  

Refining starting values:

Grid node 0:  Log likelihood = -31739.798

Fitting full model:

Iteration 0:  Log pseudolikelihood = -31739.798  (not concave)
Iteration 1:  Log pseudolikelihood = -31106.177  
Iteration 2:  Log pseudolikelihood = -30816.044  (not concave)
Iteration 3:  Log pseudolikelihood = -30592.306  
Iteration 4:  Log pseudolikelihood = -30424.748  
Iteration 5:  Log pseudolikelihood = -30401.298  
Iteration 6:  Log pseudolikelihood = -30400.886  
Iteration 7:  Log pseudolikelihood = -30400.885  

Generalized structural equation model                    Number of obs = 2,502

Response: localappt 
Family:   Bernoulli 
Link:     Logit     

Response: localelect
Family:   Bernoulli 
Link:     Logit     

Response: create    
Family:   Bernoulli 
Link:     Logit     

Response: natelect  
Family:   Bernoulli 
Link:     Logit     

Response: natappt   
Family:   Bernoulli 
Link:     Logit     

Response: natparty  
Family:   Bernoulli 
Link:     Logit     

Response: priorindep
Family:   Bernoulli 
Link:     Logit     

Response: partyage  
Family:   Gaussian  
Link:     Identity  

Response: timeparty 
Family:   Gaussian  
Link:     Identity  

Log pseudolikelihood = -30400.885

 ( 1)  [/]var(PER) = 1
                                      (Std. err. adjusted for 602 clusters in lid)
----------------------------------------------------------------------------------
                 |               Robust
                 | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
-----------------+----------------------------------------------------------------
localappt        |
             PER |   1.836184   .3848741     4.77   0.000     1.081845    2.590524
           _cons |    4.38133   .4670715     9.38   0.000     3.465887    5.296774
-----------------+----------------------------------------------------------------
localelect       |
             PER |   .6105473   .1497306     4.08   0.000     .3170808    .9040139
           _cons |   1.545396   .1392213    11.10   0.000     1.272527    1.818265
-----------------+----------------------------------------------------------------
create           |
             PER |   1.615115   .3303467     4.89   0.000     .9676472    2.262583
           _cons |  -1.341824   .1966721    -6.82   0.000    -1.727295    -.956354
-----------------+----------------------------------------------------------------
natelect         |
             PER |   1.251387   .2436687     5.14   0.000     .7738047    1.728968
           _cons |  -.7424974   .1468982    -5.05   0.000    -1.030413   -.4545823
-----------------+----------------------------------------------------------------
natappt          |
             PER |   1.209113   .1799271     6.72   0.000     .8564627    1.561764
           _cons |   .2222122   .1301053     1.71   0.088    -.0327896    .4772139
-----------------+----------------------------------------------------------------
natparty         |
             PER |   .9619203   .2332245     4.12   0.000     .5048087    1.419032
           _cons |  -1.235606   .1471304    -8.40   0.000    -1.523976   -.9472353
-----------------+----------------------------------------------------------------
priorindep       |
             PER |    1.05397    .250245     4.21   0.000     .5634984    1.544441
           _cons |  -2.397467   .2327078   -10.30   0.000    -2.853566   -1.941368
-----------------+----------------------------------------------------------------
partyage         |
             PER |  -27.26982   2.492782   -10.94   0.000    -32.15558   -22.38406
           _cons |   39.55636      2.079    19.03   0.000     35.48159    43.63112
-----------------+----------------------------------------------------------------
timeparty        |
             PER |  -8.450724   .6057403   -13.95   0.000    -9.637954   -7.263495
           _cons |   15.21103   .5919785    25.70   0.000     14.05078    16.37129
-----------------+----------------------------------------------------------------
         var(PER)|          1  (constrained)
-----------------+----------------------------------------------------------------
  var(e.partyage)|   1027.121   177.0034                      732.7139    1439.822
 var(e.timeparty)|   81.93639    13.0418                       59.9779    111.9341
----------------------------------------------------------------------------------

.                 predict persparty_mix,latent ebmeans
(using 7 quadrature points)

.                 estat ic

Akaike's information criterion and Bayesian information criterion

-----------------------------------------------------------------------------
       Model |          N   ll(null)  ll(model)      df        AIC        BIC
-------------+---------------------------------------------------------------
           . |      2,502          .  -30400.88      20   60841.77   60958.27
-----------------------------------------------------------------------------
Note: BIC uses N = number of observations. See [R] IC note.

.                 hist persparty   
(bin=33, start=-1.9346864, width=.11184624)

.                 sum persparty           

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
   persparty |      2,502     .000644    .8361771  -1.934686   1.756239

.                 replace persparty =(persparty+abs(r(min)))/(abs(r(min)) + r(max))
(2,502 real changes made)

.                 sum persparty           

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
   persparty |      2,502    .5243482    .2265494          0          1

.                 sort cow year

.                 corr persparty*
(obs=2,502)

             | perspa~y perspa~x
-------------+------------------
   persparty |   1.0000
persparty_~x |   0.9169   1.0000


.                  
.                 save pers-temp,replace
(file pers-temp.dta not found)
file pers-temp.dta saved

.                 
. ***********************************************************************
. **** Merge persparty measure with VDem parties data for validation ****
. ***********************************************************************
.                 
.                 ***************************************************************
.                 **** Expand VDem party data into country-party-year format ****
.                 ***************************************************************
.                  use V-Dem-CPD-Party-V1,clear
(V-Dem CPD)

.                  drop if v2paid==.
(0 observations deleted)

.                  egen cyvote = sum(v2pavote),by(country_name year)

.                  list country_name year if cyvote>150 & cyvote ~=.,clean noobs

    countr~e   year  
      Zambia   1964  
    Zimbabwe   1980  
    Zimbabwe   1985  
    Zimbabwe   1979  
      Zambia   1964  
      Zambia   1964  
    Zimbabwe   1980  
    Zimbabwe   1985  
    Zimbabwe   1979  
    Zimbabwe   1980  
    Zimbabwe   1985  
    Cameroon   1964  
    Cameroon   1964  
    Cameroon   1964  
    Zimbabwe   1979  
    Zimbabwe   1979  
    Zimbabwe   1980  
    Cameroon   1964  
    Zimbabwe   1979  
    Zimbabwe   1979  

.                  drop if cyvote>150 & cyvote ~=.
(20 observations deleted)

.                  gen yr = year

. 
.                          * Illiberalism *
.                  gen illiberal = v2xpa_illiberal
(5,592 missing values generated)

.                  egen pminyear =min(yr) if v2xpa_illiberal~=.,by(v2paid)
(5,592 missing values generated)

.                  gen oilliberal = illiberal if yr==pminyear
(9,957 missing values generated)

.                  egen i_illiberal = max(oilliberal),by(v2paid)
(3,536 missing values generated)

.                  
.                  * V-Party measure of populism *
.                  gen populism =v2xpa_popul
(5,587 missing values generated)

.                  gen opopulism = populism if yr==pminyear
(9,957 missing values generated)

.                  egen i_populism = max(opopulism),by(v2paid)
(3,536 missing values generated)

. 
.                  * Votes and party personalism *
.                  sum v2pavote

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
    v2pavote |      8,576    24.75009    21.32024          0        100

.                  gen vote = v2pavote/100
(3,318 missing values generated)

.                  recode vote (0=.)
(5 changes made to vote)

.                  gen ppers = v2paind
(5,591 missing values generated)

.                  qui sum ppers

.                  replace ppers = ppers+abs(r(min))
(6,303 real changes made)

.                  qui sum ppers

.                  replace ppers = ppers/r(max)
(6,302 real changes made)

.                  sum ppers

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
       ppers |      6,303    .4072429    .2085353          0          1

.                  replace ppers = ppers>.558 if ppers~=.
(6,301 real changes made)

.                  tab ppers

      ppers |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      4,727       75.00       75.00
          1 |      1,576       25.00      100.00
------------+-----------------------------------
      Total |      6,303      100.00

.  
.                  egen maxc  =max(year),by(country_name)

.                  gen maxyrc = maxc==year

.                  sort v2paid year

.                  bysort v2paid: gen diff =  year[_n+1]-year
(3,480 missing values generated)

.                  
.                  * Carry forward to 2020 *
.                  replace diff = 2020-year+1 if maxyrc==1
(967 real changes made)

.                  sort v2paid year

.                  bysort v2paid:replace diff = diff[_n-1]+1 if diff==. & v2paid==v
> 2paid[_n-1]
(1,090 real changes made)

.                  replace diff=2 if year==2019
(0 real changes made)

.                  
.                  * Carry forward from last election for the Party ID *
.                  egen max  =max(year),by(v2paid)

.                  gen maxyr =max==year

.                  replace diff = 12 if maxyr==1
(3,471 real changes made)

.                  drop max maxyr

.           
.                  expand diff
(68,253 observations created)

.                  sort country_name v2paid year

.                  bysort country_name v2paid:replace yr = yr[_n-1]+1 if year==year
> [_n-1] & v2paid==v2paid[_n-1]  
(68,253 real changes made)

.                  replace diff=1
(79,622 real changes made)

.                  
.                 * Carry backwards one year from first election for the Party ID *
.                  sort v2paid year

.                  egen min  =min(yr),by(v2paid)

.                  gen minyr =min==yr

.                  replace diff = 6 if minyr==1
(3,480 real changes made)

.                  expand diff
(17,400 observations created)

.                  drop min minyr

.                  sort country_name v2paid yr

.                  bysort country_name v2paid:replace yr = yr-1 if yr==yr[_n+1] & v
> 2paid==v2paid[_n+1] & diff>=2 
(17,400 real changes made)

.                  sort country_name v2paid yr

.                  bysort country_name v2paid:replace yr = yr-1 if yr==yr[_n+1] & v
> 2paid==v2paid[_n+1] & diff>=2 
(13,920 real changes made)

.                  sort country_name v2paid yr

.                  bysort country_name v2paid:replace yr = yr-1 if yr==yr[_n+1] & v
> 2paid==v2paid[_n+1] & diff>=2 
(10,440 real changes made)

.                  sort country_name v2paid yr

.                  bysort country_name v2paid:replace yr = yr-1 if yr==yr[_n+1] & v
> 2paid==v2paid[_n+1] & diff>=2 
(6,960 real changes made)

.                  sort country_name v2paid yr

.                  bysort country_name v2paid:replace yr = yr-1 if yr==yr[_n+1] & v
> 2paid==v2paid[_n+1] & diff>=2 
(3,480 real changes made)

.                  
.                  drop opopulism oilliberal  

.                  
.                  * Generate lags *
.                  xtset v2paid yr

Panel variable: v2paid (unbalanced)
 Time variable: yr, 1895 to 2030
         Delta: 1 unit

.                  forval i = 1/4 {
  2.                         local var = "illiberal populism ppers"
  3.                         foreach v of local var {
  4.                                 gen l`i'`v'=l`i'.`v'
  5.                         }
  6.                  }
(50,203 missing values generated)
(50,144 missing values generated)
(50,173 missing values generated)
(52,057 missing values generated)
(52,000 missing values generated)
(52,022 missing values generated)
(53,911 missing values generated)
(53,856 missing values generated)
(53,871 missing values generated)
(55,765 missing values generated)
(55,712 missing values generated)
(55,720 missing values generated)

.                  
.                  
.                  drop year

.                  rename yr year

.                  sort v2paid year

.                  save vdem-parties-merge,replace                 
file vdem-parties-merge.dta saved

.                 
.                  ****************************************************************
> *************
.                  *** Merge VDem country-party-year data with personalist country-
> year data ***
.                  ****************************************************************
> *************
.                 use pers-temp,clear

.                 keep if year>=1990  
(2 observations deleted)

.                 gen v2paid = electing_p_id
(65 missing values generated)

.                 /*
>                  We have double-checked these parties, which do not appear in the
>  VDem parties data set:
>                 (1) Nepali Congress (Democratic)-NC (D) is not the same (in 2005)
>  as the Nepali Congress (ID 3756)
>                 (2) Unified Communist Party of Nepal (Maoist)-UCPN (M) is not the
>  same as 
>                         Communist Party of Nepal (Unified Marxist-Leninist)-CPN (
> UML) (ID 3755)
>                 (3) Sri Lanka Podujana Peramuna (SLPP) postdates the VDem parties
>  data set: 
>                         The SLPP was effectively re-launched in November 2016 by 
> Mahinda Rajapaksa; 
>                         The Sri Lanka National Front (SLNF) was minor party renam
> ed Our Sri Lanka Freedom Front (OSLFF) 
>                         in 2015; However, OSLFF was relaunched by Mahinda Rajapak
> sa in 2016 as the Sri Lanka Podujana 
>                         Peramuna (SLPP) and became the home for Rajapaksa support
> ers and Rajapaksa-faction members 
>                         of the United People's Freedom Alliance (UFPA) and Sri La
> nka Freedom Party (SLFP), both
>                         of which had backed Mahinda Rajapaksa in the 2005 electio
> n.
>                 (4) Shekhar broke with the Janata Dal Party on November 5, 1990 a
> nd formed the 
>                         Janata Dal-Socialist faction. When selected PM in in Nov 
> 1990, Shekhar was backed by the INC
>                         but his party was the Janata Dal-Socialists not the rump 
> Janata Dal Party (ID 1207)
>                 (5) AKFM-Fanavaozana split from AKFM in 1989 when AKFM refused to
>  nominate Andriamanjato as its
>                         presidential candidate. In 1990, AKFM-Fanavaozana joined 
> with other opposition groups 
>                         to form the Comité des Forces Vives (ID 5368) and backed 
> Zafy in the 1993 presidential election.
>                 (6) New Force for Madagascar (Hery Vaovao ho an'i Madagasikara–HV
> M) is not included in VDem-Parties; 
>                         PartyFacts group HVM and TGV together as other (ID 5207)
>                 (7) Madagascar  2019 Rajoelina  TGV not in VDem-Parties but has a
>  grouped PartyFacts ID (5207)
>                 (8) Sovereign Communists/Party of Power in Urkaine was the groupi
> ng of supporters for Kravchuk; 
>                         These groups were not formally registered political parti
> es. VDem
>                         does not record this grouping as political party during t
> his period.
>                 (9) National Reconstruction Party (PRN) in Brazil 1991-1992 has a
>  PartyFacts ID (4410) but
>                         is not included in the VDem-Parties data.
>                 (10) Peasant Response Party - Haiti/Martelly 2011 - has a PartyFa
> ctsID (6069) but not in VDem-Parties.
>                 (11) Ukraine's Inter-Regional Bloc of Reforms (MRBR) (PartyFacts 
> ID 2227) is not in VDem-Parties.
>                 (12) Ukraine's Sovereign Communists/Party of Power has neither a 
> PartyFacts ID nor is in VDem-Parties.
>                 (13) (North) Macedonia's Social Democratic Union of Macedonia (Pa
> rtyFacts ID 1508) 
>                          is not in VDem-Parties.
>                 (14) Slovenian Christian Democrats (Slovenski krščanski demokrati
> , SKD, PartyFactsID 644) is
>                          not in VDem-Parties.
>                 (15) Lithuania's Sajudis Party/Sajudzio koalicija (1991) has Part
> yFacts ID 743 but
>                          is not in VDem-Parties.
>                 */
.                 
.                 sort v2paid year

.                 merge v2paid year using vdem-parties-merge, 
(you are using old merge syntax; see [D] merge for new syntax)
variables v2paid year do not uniquely identify observations in the master data
(variable v2paid was float, now double to accommodate using data's values)
(variable year was int, now float to accommodate using data's values)

.                 tab _merge

     _merge |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |         88        0.09        0.09
          2 |     95,135       97.44       97.53
          3 |      2,412        2.47      100.00
------------+-----------------------------------
      Total |     97,635      100.00

.                 drop if _merge ==2
(95,135 observations deleted)

.                 egen tag = tag(country current_leader) if _merge==1

.                 list country year current_leader electing_p_id electing_p_name if
>  tag==1, noobs clean

          country   year             current_leader   electi~d                     
>                  electing_p_name  
         Slovenia   1991              Lojze Peterle        644                     
>    Slovenian Christian Democrats  
        Lithuania   1991       Vytautas Landsbergis        743                     
>                    Sajudis Party  
          Ukraine   1995              Leonid Kuchma       2227                Inter
> -Regional Bloc of Reforms (MRBR)  
           Brazil   1991   Fernando Collor de Mello       4410                  Nat
> ional Reconstruction Party (PRN)  
           Brazil   1993              Itamar Franco       4410                  Nat
> ional Reconstruction Party (PRN)  
            Haiti   2012            Michel Martelly       6069                     
>           Peasant Response Party  
         Bulgaria   1991              Dimitar Popov          .                     
>                              N/A  
            India   1991            Chandra Shekhar          .                     
>             Janata Dal-Socialist  
          Ukraine   1992            Leonid Kravchuk          .                  Sov
> ereign Communists/Party of Power  
           Latvia   1996                Andre Škéle          .                     
>                              N/A  
       Madagascar   1997      Norbert Ratsirahonana          .                     
>                 AKFM-Fanavaozana  
          Lebanon   1999               Émile Lahoud          .                     
>                              N/A  
            Nepal   2005         Sher Bahadur Deuba          .                  Nep
> ali Congress (Democratic)-NC (D)  
    Guinea Bissau   2006                 Joao Viera          .                     
>                              N/A  
            Benin   2007           Thomas Boni Yayi          .                     
>                              N/A  
          Lebanon   2009            Michel Suleiman          .                     
>                              N/A  
            Nepal   2012          Baburam Bhattarai          .   Unified Communist 
> Party of Nepal (Maoist)-UCPN (M)  
       Madagascar   2014   Hery Rajaonarimampianina          .        New Force for
>  Madagascar (PartyFacts ID 5207)  
          Lebanon   2015               Tammam Salam          .                     
>                              N/A  
      Afghanistan   2015               Ashraf Ghani          .                     
>                              N/A  
            Nepal   2017         Pushpa Kamal Dahal          .   Unified Communist 
> Party of Nepal (Maoist)-UCPN (M)  
            Benin   2017              Patrice Talon          .                     
>                              N/A  
             Iraq   2019           Adel Abdul-Mahdi          .                     
>                              N/A  
       Madagascar   2019                  Rajoelina          .                     
>         TGV (PartyFacts ID 5207)  
        Sri Lanka   2020         Gotabaya Rajapaksa          .                   Sr
> i Lanka Podujana Peramuna (SLPP)  
          Lebanon   2020                Hassan Diab          .                     
>                              N/A  
        Lithuania   2020            Gitanas Nauseda          .                     
>                              N/A  

.                 drop _merge

.                 sort cowcode year

.                 xtset cowcode year

Panel variable: cowcode (unbalanced)
 Time variable: year, 1991 to 2020, but with gaps
         Delta: 1 unit

. 
.                 sort cowcode year

.                 merge cowcode year using master
(you are using old merge syntax; see [D] merge for new syntax)
(variable country was str30, now str45 to accommodate using data's values)
(variable year was float, now double to accommodate using data's values)
(variable cowcode was float, now double to accommodate using data's values)

.                 tab _merge

     _merge |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |         16        0.22        0.22
          2 |      4,667       65.12       65.34
          3 |      2,484       34.66      100.00
------------+-----------------------------------
      Total |      7,167      100.00

.                 list country year if _merge==1,clean noobs

       country   year  
    Luxembourg   2006  
    Luxembourg   2007  
    Luxembourg   2008  
    Luxembourg   2009  
    Luxembourg   2010  
    Luxembourg   2011  
    Luxembourg   2012  
    Luxembourg   2013  
    Luxembourg   2014  
    Luxembourg   2015  
    Luxembourg   2016  
    Luxembourg   2017  
    Luxembourg   2018  
    Luxembourg   2019  
    Luxembourg   2020  
        Kosovo   2008  

.                 drop if _merge==1
(16 observations deleted)

.                 drop _merge

. 
.                 
.                 xtset cowcode year

Panel variable: cowcode (unbalanced)
 Time variable: year, 1978 to 2020
         Delta: 1 unit

.                 gen lv2paind= l.v2paind 
(4,926 missing values generated)

.                 gen legit=  l.v2exl_legitlead  /* lag 1 year to ensure not endoge
> nous to backsliding event */
(2,486 missing values generated)

.                 gen olv2paind= l.v2paind_ord 
(4,926 missing values generated)

.                 gen olegit=  l.v2exl_legitlead_ord  /* lag 1 year to ensure not e
> ndogenous to backsliding event */
(2,486 missing values generated)

.                 recode gwf_back (.=0) if country=="Luxembourg"
(28 changes made to gwf_back)

. 
.                 gen type = reign_regimetype
(2,363 missing values generated)

.                 sort cowcode year

.                 replace type = reign_regimetype[_n-1] if type~="presidential" & t
> ype~="parliamentary"
(319 real changes made)

.                 sort cowcode year

.                 replace type = type[_n-1] if type~="presidential" & type~="parlia
> mentary"
(4,451 real changes made)

.                 
.                 
.                 gen demsample= year>=1991 & year<=2020 & gwf_back~=. & (gwf_regim
> e=="democracy" | gwf_regime=="provisional")

.                 keep if (gwf_regime=="democracy" | gwf_regime=="provisional") & y
> ear>=1991
(4,689 observations deleted)

.                 keep if current_leader~=""
(70 observations deleted)

.  
.                 * Rescale on 0,1 *
.                 qui sum persparty  

.                 replace persparty =(persparty+abs(r(min)))/(abs(r(min)) + r(max))
(0 real changes made)

.                  
.                 * Take a look *
.                 xtsum    persparty   

Variable         |      Mean   Std. dev.       Min        Max |    Observations
-----------------+--------------------------------------------+----------------
perspa~y overall |  .5258306   .2247548          0          1 |     N =    2392
         between |             .1836447   .1146158          1 |     n =     106
         within  |             .1403338  -.0155534   1.074873 | T-bar =  22.566

.                 sfrancia persparty  

                  Shapiro–Francia W' test for normal data

    Variable |       Obs       W'          V'        z       Prob>z
-------------+-----------------------------------------------------
   persparty |     2,392    0.98135     27.581     8.031    0.00001

.                 
.                 ***********************
.                 * Internal validation *
.                 ***********************
.                           * LOO *
.                          qui alpha create natelect natappt localappt priorindep l
> ocalelect natparty partyexp,gen(a) 

.                          qui alpha natelect natappt localappt priorindep localele
> ct natparty partyexp,gen(a1) 

.                          qui alpha create natappt localappt priorindep localelect
>  natparty partyexp,gen(a2) 

.                          qui alpha create natelect natappt priorindep localelect 
> natparty partyexp,gen(a3) 

.                          qui alpha create natelect natappt localappt localelect n
> atparty partyexp,gen(a4) 

.                          qui alpha create natelect natappt localappt localelect n
> atparty partyexp,gen(a5)  

.                          qui alpha create natelect natappt localappt priorindep n
> atparty partyexp,gen(a6) 

.                          qui alpha create natelect natappt localappt priorindep l
> ocalelect partyexp,gen(a7)   

.                          qui alpha create natelect natappt localappt priorindep l
> ocalelect,gen(a8)   

. 
.                          corr a a1 a2 a3 a4 a5 a6 a7 a8 
(obs=2,392)

             |        a       a1       a2       a3       a4       a5       a6
-------------+---------------------------------------------------------------
           a |   1.0000
          a1 |   0.9697   1.0000
          a2 |   0.9673   0.9184   1.0000
          a3 |   0.9929   0.9606   0.9549   1.0000
          a4 |   0.9833   0.9435   0.9429   0.9750   1.0000
          a5 |   0.9833   0.9435   0.9429   0.9750   1.0000   1.0000
          a6 |   0.9739   0.9406   0.9318   0.9679   0.9527   0.9527   1.0000
          a7 |   0.9693   0.9182   0.9436   0.9568   0.9533   0.9533   0.9345
          a8 |   0.9429   0.8910   0.9023   0.9274   0.9243   0.9243   0.8990

             |       a7       a8
-------------+------------------
          a7 |   1.0000
          a8 |   0.9671   1.0000


.                          drop a a1 a2 a3 a4 a5 a6 a7 a8

.                         
.                         * Split sample reliability *
.                         global pparty="persparty"

.                         ** Internal reliability checks **
.                         gen early=year<=2006 if $pparty~=.

.                         tab early if $pparty~=.

      early |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      1,225       51.21       51.21
          1 |      1,167       48.79      100.00
------------+-----------------------------------
      Total |      2,392      100.00

.                         replace gdp=gdp/1000
(2,282 real changes made)

.                         gen poor =gdp<  59.17128 if $pparty~=.

.                         tab poor if $pparty~=.

       poor |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |        110        4.60        4.60
          1 |      2,282       95.40      100.00
------------+-----------------------------------
      Total |      2,392      100.00

.                         gen lopop = lpop<16.16824 if $pparty~=. & lpop~=.
(63 missing values generated)

.                         tab lopop if $pparty~=.

      lopop |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      1,179       50.62       50.62
          1 |      1,150       49.38      100.00
------------+-----------------------------------
      Total |      2,329      100.00

.                         gen new =gwf_duration<19 if $pparty~=.

.                         tab new if $pparty~=.

        new |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      1,244       52.01       52.01
          1 |      1,148       47.99      100.00
------------+-----------------------------------
      Total |      2,392      100.00

.                         gen hipartyinst= v2xps_party>=.784  if $pparty~=. & v2xps
> _party~=.
(11 missing values generated)

.                         tab hipartyinst if $pparty~=.

hipartyinst |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      1,279       53.72       53.72
          1 |      1,102       46.28      100.00
------------+-----------------------------------
      Total |      2,381      100.00

.                         gen dtype = type=="presidential"

.                         tab dtype if $pparty~=.

      dtype |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      1,191       49.79       49.79
          1 |      1,201       50.21      100.00
------------+-----------------------------------
      Total |      2,392      100.00

.                         gen eur=cowcode>=200 & cowcode<400

.                         tab eur

        eur |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      1,433       59.91       59.91
          1 |        959       40.09      100.00
------------+-----------------------------------
      Total |      2,392      100.00

.                         gen afr  = cowcode>=400 & cowcode<=630

.                         tab afr if $pparty~=.

        afr |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      1,978       82.69       82.69
          1 |        414       17.31      100.00
------------+-----------------------------------
      Total |      2,392      100.00

.                         sum dtype early poor lopop new hipartyins eur afr

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
       dtype |      2,392    .5020903    .5001002          0          1
       early |      2,392    .4878763    .4999575          0          1
        poor |      2,392    .9540134    .2094999          0          1
       lopop |      2,329    .4937742    .5000686          0          1
         new |      2,392    .4799331    .4997016          0          1
-------------+---------------------------------------------------------
 hipartyinst |      2,381    .4628307    .4987213          0          1
         eur |      2,392    .4009197    .4901873          0          1
         afr |      2,392    .1730769    .3783929          0          1

.                         matrix m = J(8,1,.)

.                         local var = "dtype early poor lopop new hipartyinst eur a
> fr" 

.                         local i =1

.                         foreach v of local var {
  2.                                 qui gsem (PER->create natelect natappt localap
> pt localelect natparty priorindep partyexp  ///
>                                         if `v'~=. & $pparty~=.,logit var(PER@1) g
> roup(`v'))
  3.                                 predict `v'pparty,latent ebmeans
  4.                                 spearman `v'pparty $pparty
  5.                                 matrix j = r(rho)
  6.                                 local s = round(j[1,1],.01)
  7.                                 matrix m[`i',1] =`s'
  8.                                 local i= `i' + 1
  9.                                 drop `v'pparty
 10.                         }
(using 7 quadrature points)

Number of observations =  2,392
        Spearman's rho = 0.9675

Test of H0: dtypepparty and persparty are independent
                  Prob = 0.0000
(using 7 quadrature points)

Number of observations =  2,392
        Spearman's rho = 0.9983

Test of H0: earlypparty and persparty are independent
                  Prob = 0.0000
(using 7 quadrature points)

Number of observations =  2,392
        Spearman's rho = 0.9986

Test of H0: poorpparty and persparty are independent
                  Prob = 0.0000
(using 7 quadrature points)

Number of observations =  2,392
        Spearman's rho = 0.9874

Test of H0: lopoppparty and persparty are independent
                  Prob = 0.0000
(using 7 quadrature points)

Number of observations =  2,392
        Spearman's rho = 0.9768

Test of H0: newpparty and persparty are independent
                  Prob = 0.0000
(using 7 quadrature points)

Number of observations =  2,392
        Spearman's rho = 0.9351

Test of H0: hipartyinstpparty and persparty are independent
                  Prob = 0.0000
(using 7 quadrature points)

Number of observations =  2,392
        Spearman's rho = 0.9849

Test of H0: eurpparty and persparty are independent
                  Prob = 0.0000
(using 7 quadrature points)

Number of observations =  2,392
        Spearman's rho = 0.9859

Test of H0: afrpparty and persparty are independent
                  Prob = 0.0000

.                         mat rownames m = Pres/parl Pre/post2005 Income Population
>  DemocracyAge PartyInst Europe Africa

.                         matrix list m

m[8,1]
               c1
   Pres/parl  .97
Pre/post2005    1
      Income    1
  Population  .99
DemocracyAge  .98
   PartyInst  .94
      Europe  .98
      Africa  .99

.                         plotmatrix, m(m)c(ltblue)legend(off)title(Internal valida
> tion,size(medium))freq split(0(.01)1)  ///
>                                 xsize(2)ysize(5)xlab(1 "Personalist party") ylab(
> 0 "Pres/parl" -1 "Pre/post 2005" -2 `""High/low" "income ""' ///
>                                 -3 `""Large/small" "population ""' -4 `""New/old 
>  " "democracy""'  ///
>                                 -5 `""High/low party   " "institutionalization""'
>  -6 `""Within/outside" "Europe     ""' ///
>                                 -7 `""Within/outside" "Africa     ""',labsize(med
> ))  
SPLIT 0 .01 .02 .03 .04 .05 .06 .07 .08 .09 .1 .11 .12 .13 .14 .15 .16 .17 .18 .19 
> .2 .21 .22 .23 .24 .25 .26 .27 .28 .29 .3 .31 .32 .33 .34 .35 .36 .37 .38 .39 .4 
> .41 .42 .43 .44 .45 .46 .47 .48 .49 .5 .51 .52 .53 .54 .55 .56 .57 .58 .59 .6 .61
>  .62 .63 .64 .65 .66 .67 .68 .69 .7 .71 .72 .73 .74 .75 .76 .77 .78 .79 .8 .81 .8
> 2 .83 .84 .85 .86 .87 .88 .89 .9 .91 .92 .93 .94 .95 .96 .97 .98 .99 1
(note:  named style med not found in class gsize, default attributes used)

.                         drop dtype early poor lopop new hipartyinst eur afr

.                 
.          
.                 ***********************
.                 * External validation *
.                 ***********************
.                    * correlations with external measures*
.                         matrix m = J(6,6,.)

.                         matrix list m

symmetric m[6,6]
    c1  c2  c3  c4  c5  c6
r1   .
r2   .   .
r3   .   .   .
r4   .   .   .   .
r5   .   .   .   .   .
r6   .   .   .   .   .   .

.                         local dimensions = "create persparty v2paind v2exl_legitl
> ead v2xps_party v2x_polyarchy"

.                         local i=1

.                         foreach t of local dimensions {
  2.                                 local j = 1
  3.                                 local klass = "create persparty v2paind v2exl_
> legitlead v2xps_party  v2x_polyarchy"
  4.                                 foreach k of local klass {
  5.                                         spearman `t' `k' if persparty~=.
  6.                                         matrix j = r(rho)
  7.                                         local s = round(j[1,1],.01)
  8.                                         matrix m[`i',`j'] =`s'
  9.                                         local j= `j' + 1
 10.                                 }
 11.                                 local i = `i'+1
 12.                         }

Number of observations =  2,392
        Spearman's rho = 1.0000

Test of H0: create and create are independent
                  Prob = 0.0000

Number of observations =  2,392
        Spearman's rho = 0.7075

Test of H0: create and persparty are independent
                  Prob = 0.0000

Number of observations =  2,243
        Spearman's rho = 0.3233

Test of H0: create and v2paind are independent
                  Prob = 0.0000

Number of observations =  2,390
        Spearman's rho = 0.3074

Test of H0: create and v2exl_legitlead are independent
                  Prob = 0.0000

Number of observations =   2,381
        Spearman's rho = -0.3152

Test of H0: create and v2xps_party are independent
                  Prob =  0.0000

Number of observations =   2,392
        Spearman's rho = -0.3062

Test of H0: create and v2x_polyarchy are independent
                  Prob =  0.0000

Number of observations =  2,392
        Spearman's rho = 0.7075

Test of H0: persparty and create are independent
                  Prob = 0.0000

Number of observations =  2,392
        Spearman's rho = 1.0000

Test of H0: persparty and persparty are independent
                  Prob = 0.0000

Number of observations =  2,243
        Spearman's rho = 0.3961

Test of H0: persparty and v2paind are independent
                  Prob = 0.0000

Number of observations =  2,390
        Spearman's rho = 0.3670

Test of H0: persparty and v2exl_legitlead are independent
                  Prob = 0.0000

Number of observations =   2,381
        Spearman's rho = -0.4931

Test of H0: persparty and v2xps_party are independent
                  Prob =  0.0000

Number of observations =   2,392
        Spearman's rho = -0.4335

Test of H0: persparty and v2x_polyarchy are independent
                  Prob =  0.0000

Number of observations =  2,243
        Spearman's rho = 0.3233

Test of H0: v2paind and create are independent
                  Prob = 0.0000

Number of observations =  2,243
        Spearman's rho = 0.3961

Test of H0: v2paind and persparty are independent
                  Prob = 0.0000

Number of observations =  2,243
        Spearman's rho = 1.0000

Test of H0: v2paind and v2paind are independent
                  Prob = 0.0000

Number of observations =  2,241
        Spearman's rho = 0.3715

Test of H0: v2paind and v2exl_legitlead are independent
                  Prob = 0.0000

Number of observations =   2,233
        Spearman's rho = -0.4000

Test of H0: v2paind and v2xps_party are independent
                  Prob =  0.0000

Number of observations =   2,243
        Spearman's rho = -0.4341

Test of H0: v2paind and v2x_polyarchy are independent
                  Prob =  0.0000

Number of observations =  2,390
        Spearman's rho = 0.3074

Test of H0: v2exl_legitlead and create are independent
                  Prob = 0.0000

Number of observations =  2,390
        Spearman's rho = 0.3670

Test of H0: v2exl_legitlead and persparty are independent
                  Prob = 0.0000

Number of observations =  2,241
        Spearman's rho = 0.3715

Test of H0: v2exl_legitlead and v2paind are independent
                  Prob = 0.0000

Number of observations =  2,390
        Spearman's rho = 1.0000

Test of H0: v2exl_legitlead and v2exl_legitlead are independent
                  Prob = 0.0000

Number of observations =   2,379
        Spearman's rho = -0.5519

Test of H0: v2exl_legitlead and v2xps_party are independent
                  Prob =  0.0000

Number of observations =   2,390
        Spearman's rho = -0.6392

Test of H0: v2exl_legitlead and v2x_polyarchy are independent
                  Prob =  0.0000

Number of observations =   2,381
        Spearman's rho = -0.3152

Test of H0: v2xps_party and create are independent
                  Prob =  0.0000

Number of observations =   2,381
        Spearman's rho = -0.4931

Test of H0: v2xps_party and persparty are independent
                  Prob =  0.0000

Number of observations =   2,233
        Spearman's rho = -0.4000

Test of H0: v2xps_party and v2paind are independent
                  Prob =  0.0000

Number of observations =   2,379
        Spearman's rho = -0.5519

Test of H0: v2xps_party and v2exl_legitlead are independent
                  Prob =  0.0000

Number of observations =  2,381
        Spearman's rho = 1.0000

Test of H0: v2xps_party and v2xps_party are independent
                  Prob = 0.0000

Number of observations =  2,381
        Spearman's rho = 0.7790

Test of H0: v2xps_party and v2x_polyarchy are independent
                  Prob = 0.0000

Number of observations =   2,392
        Spearman's rho = -0.3062

Test of H0: v2x_polyarchy and create are independent
                  Prob =  0.0000

Number of observations =   2,392
        Spearman's rho = -0.4335

Test of H0: v2x_polyarchy and persparty are independent
                  Prob =  0.0000

Number of observations =   2,243
        Spearman's rho = -0.4341

Test of H0: v2x_polyarchy and v2paind are independent
                  Prob =  0.0000

Number of observations =   2,390
        Spearman's rho = -0.6392

Test of H0: v2x_polyarchy and v2exl_legitlead are independent
                  Prob =  0.0000

Number of observations =  2,381
        Spearman's rho = 0.7790

Test of H0: v2x_polyarchy and v2xps_party are independent
                  Prob = 0.0000

Number of observations =  2,392
        Spearman's rho = 1.0000

Test of H0: v2x_polyarchy and v2x_polyarchy are independent
                  Prob = 0.0000

.                         matrix list m

symmetric m[6,6]
      c1    c2    c3    c4    c5    c6
r1     1
r2   .71     1
r3   .32    .4     1
r4   .31   .37   .37     1
r5  -.32  -.49   -.4  -.55     1
r6  -.31  -.43  -.43  -.64   .78     1

.                         plotmatrix, m(m) c(gs10) legend(off) title(Correlation ma
> trix,size(medium)) freq split(0(.01)1)  ///
>                                 xsize(3)ysize(2)xlab(1 "Create party" 2 "Party pe
> rs." 3 "V-Party Pers." ///
>                                 4 "V-Legit leader" 5 "V-Party inst." 6 "V-Democra
> cy",labsize(vsmall)) ///
>                                 ylab(0 "Create party" -1 "Party pers." -2 "V-Part
> y Pers." ///
>                                 -3 "V-Legit leader" -4 "V-Party inst." -5 "V-Demo
> cracy",labsize(vsmall))  
SPLIT 0 .01 .02 .03 .04 .05 .06 .07 .08 .09 .1 .11 .12 .13 .14 .15 .16 .17 .18 .19 
> .2 .21 .22 .23 .24 .25 .26 .27 .28 .29 .3 .31 .32 .33 .34 .35 .36 .37 .38 .39 .4 
> .41 .42 .43 .44 .45 .46 .47 .48 .49 .5 .51 .52 .53 .54 .55 .56 .57 .58 .59 .6 .61
>  .62 .63 .64 .65 .66 .67 .68 .69 .7 .71 .72 .73 .74 .75 .76 .77 .78 .79 .8 .81 .8
> 2 .83 .84 .85 .86 .87 .88 .89 .9 .91 .92 .93 .94 .95 .96 .97 .98 .99 1

.                         gr export "$dir\golden\Ch2A-ExCorr.pdf",as(pdf)replace 
file
    C:\Users\jgw12\Dropbox\Research\PersPartyBook\Data\FKTW-reproduction\golden\C
    > h2A-ExCorr.pdf saved as PDF format

.                 drop if persparty==.
(0 observations deleted)

.                 
.                 * Generate some system variables *
.                 gen priormil = gwf_priorreg=="military" | gwf_priorreg=="indirect
>  military" | gwf_priorreg=="milpersonal"

.                 gen pres=type=="presidential" if type~=""

.                 tab pres type,m 

           |         type
      pres | parliam..  preside.. |     Total
-----------+----------------------+----------
         0 |     1,191          0 |     1,191 
         1 |         0      1,201 |     1,201 
-----------+----------------------+----------
     Total |     1,191      1,201 |     2,392 

.                 
.                 *** Time periods ***
.                 gen period = year<=1995

.                 replace period = 2 if year>1995 & year<=2000
(366 real changes made)

.                 replace period = 3 if year>2000 & year<=2005
(401 real changes made)

.                 replace period = 4 if year>2005 & year<=2010
(421 real changes made)

.                 replace period = 5 if year>2010 & year<=2015
(435 real changes made)

.                 replace period = 6 if year>2015  
(452 real changes made)

.                 gen xperiod1 = year<=1995

.                 gen xperiod2 = year>1995 & year<=2000

.                 gen xperiod3 = year>2000 & year<=2005

.                 gen xperiod4 = year>2005 & year<=2010

.                 gen xperiod5 = year>2010 & year<=2015

.                 gen xperiod6 = year>2015  

.                 tab period

     period |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |        317       13.25       13.25
          2 |        366       15.30       28.55
          3 |        401       16.76       45.32
          4 |        421       17.60       62.92
          5 |        435       18.19       81.10
          6 |        452       18.90      100.00
------------+-----------------------------------
      Total |      2,392      100.00

.                 global pparty="persparty"

.                 
.                 * Initial levels of democracy and party institutionalization *
.                 gen ld = ln(1+gwf_duration)

.                 gen odem = l1v2x_polyarchy if minyr==year
(1,815 missing values generated)

.                 replace odem = l1v2x_polyarchy if minyr+1==year & odem==.
(477 real changes made)

.                 replace odem =v2x_polyarchy if minyr==year  & odem==.
(1 real change made)

.                 egen ivdem = max(odem),by(lid) 
(11 missing values generated)

.                 replace ivdem = l1v2x_polyarchy if ivdem==.
(11 real changes made)

.                 gen opi = l2v2xps_party if minyr==year
(1,827 missing values generated)

.                 replace opi = l1v2xps_party if minyr==year & opi==. &  l1v2xps_pa
> rty~=.
(10 real changes made)

.                 egen ipi = max(opi),by(lid)
(71 missing values generated)

.                 
.                 * Electoral system data from VDem: carry forward from past electi
> on *
.                 local var ="v2elloelsy v2elparlel"

.                 foreach v of local var {
  2.                         forval i = 1/4 {
  3.                                 replace `v'=l`i'`v' if `v'==.
  4.                         }
  5.                         forval i = 1/8 {
  6.                                 replace `v'=l`i'.l4`v' if `v'==.
  7.                         }
  8.                         replace `v'=f.`v' if `v'==.
  9.                         replace `v'=f2.`v' if `v'==.
 10.                         replace `v'=f3.`v' if `v'==.
 11.                         
.                 }
(626 real changes made)
(543 real changes made)
(428 real changes made)
(138 real changes made)
(19 real changes made)
(3 real changes made)
(1 real change made)
(1 real change made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(9 real changes made)
(10 real changes made)
(0 real changes made)
(621 real changes made)
(545 real changes made)
(429 real changes made)
(138 real changes made)
(19 real changes made)
(3 real changes made)
(1 real change made)
(1 real change made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(8 real changes made)
(11 real changes made)
(3 real changes made)

.          
.                         recode v2elparlel (.=1) if country=="Argentina" | country
> =="Armenia"
(4 changes made to v2elparlel)

.                         recode v2elparlel (.=0) if country=="Malaysia" | country=
> ="Gambia"              
(0 changes made to v2elparlel)

.                         forval i = 1/4 {
  2.                                 replace v2ellostsl=l`i'v2ellostsl if v2ellosts
> l==.
  3.                                 replace v2ellostss=l`i'v2ellostss if v2ellosts
> s==.
  4.                         }
(616 real changes made)
(616 real changes made)
(543 real changes made)
(542 real changes made)
(433 real changes made)
(431 real changes made)
(141 real changes made)
(140 real changes made)

.                         
.                         forval i = 1/8 {
  2.                                 replace v2ellostsl=l`i'.l4v2ellostsl if v2ello
> stsl==.
  3.                                 replace v2ellostss=l`i'.l4v2ellostss if v2ello
> stss==.
  4.                         }
(22 real changes made)
(22 real changes made)
(6 real changes made)
(6 real changes made)
(2 real changes made)
(2 real changes made)
(1 real change made)
(1 real change made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)

.                          
. 
.                 * Sample *
.                 * GNB 2012: non-personalist leader dies a naturual death 9 Jan 20
> 12; 
.                 * interim president takes over and their is a coup in April 
.                 * drop the interim leader who is unelected
.                 gen GNB = year==2012 & country=="Guinea Bissau"  

.                 keep if current_leader~="" & (gwf_democracy==1  | gwf_provisional
> ==1)
(0 observations deleted)

.                 
.                 gen leadertimeinpower = 0 if year==minyr
(1,814 missing values generated)

.                 sort lid year

.                 bysort lid: replace leadertimein=leadertimein[_n-1]+1 if leaderti
> mein==. & lid==lid[_n-1]
(1,767 real changes made)

.                 
.                 * Political-geographic region *
.                 recode e_regionpol_6C (2=4) if country=="Guinea Bissau"
(0 changes made to e_regionpol_6C)

.                 egen pregion = max( e_regionpol_6C),by(cowcode)
(5 missing values generated)

.                 tab pregion, m

    pregion |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |        522       21.82       21.82
          2 |        508       21.24       43.06
          3 |         87        3.64       46.70
          4 |        405       16.93       63.63
          5 |        594       24.83       88.46
          6 |        271       11.33       99.79
          . |          5        0.21      100.00
------------+-----------------------------------
      Total |      2,392      100.00

.                 recode pregion  (.=5) /* Afghanistan */
(5 changes made to pregion)

.                 
.                 tsset cowcode year

Panel variable: cowcode (unbalanced)
 Time variable: year, 1991 to 2020, but with gaps
         Delta: 1 unit

.                 sort cowcode year

.                 save pers-use,replace
file pers-use.dta saved

.          
.                  erase pers-temp.dta

.                  erase master.dta

.                  erase wdi-merge2.dta            

.         
.         ************** THE END ******************
. 
.         log close
      name:  <unnamed>
       log:  C:\Users\jgw12\Dropbox\Research\PersPartyBook\Data\FKTW-reproduction\C
> h2-Appendix.log
  log type:  text
 closed on:  26 Jul 2023, 15:52:21
-----------------------------------------------------------------------------------
